Dear Statalist, I am working with a longitudinal data structure, and I need to deal with several repeated obs. that I will use to put the data in a long format. Stata does not allow me to do it, so one option would be to erase those duplicates. However, since there is a lot of them, I would like to keep those obs. My idea is to change the date1 (+ 1 date) for those obs. with the same date1 within each person. My point is that there are people with none, 1, 2, or 3 (but could be even more) repeated obs. and I do not know how to do it other than by hand (and there are a lot).
For instance, for those id having 4 equal data1 (see id 3 below), I would need that the second obs. of variable date1 to be +1 day, the third to be +2 days, and the fourth to be +3 days...
Is there any way to automate this process for those id with repeated obs. like for instance in a loop?

Many thanks in advance.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte dup float(id date1 date2)
1 1 14503 14624
1 1 14503 14624
1 1 14927 14980
1 1 14927 14980
1 1 15166 15166
1 1 15166 15166
1 1 15168 15168
1 1 15168 15168
1 1 15170 15170
1 1 15170 15170
1 1 15173 15173
1 1 15173 15173
1 1 15176 15176
1 1 15176 15176
1 1 15179 15180
1 1 15179 15180
1 1 15186 15187
1 1 15186 15187
1 1 15189 15190
1 2 16610 16694
1 2 16610 16694
1 2 16981 17047
1 2 16981 17047
1 2 17348 17425
1 2 17348 17425
1 2 17717     .
1 2 17717     .
1 2 17800     .
1 2 17800     .
1 2 18074     .
1 2 18074     .
1 2 18084 18090
1 2 18084 18090
1 2 18092 18097
1 2 18092 18097
1 2 18099 18140
1 2 18099 18140
1 2 18102     .
1 2 18102     .
1 2 18326     .
1 3 17366 17370
1 3 17366 17370
1 3 17730 17734
1 3 17730 17734
1 3 18094 18098
1 3 18094 18098
1 3 20235     .
1 3 20235     .
3 3 20270     .
3 3 20270     .
3 3 20270     .
3 3 20270     .
1 3 21832 21851
1 3 21832 21851
0 4 17228     .
0 4 19864 21324
2 4 21332     .
2 4 21332     .
2 4 21332     .
2 4 21463 21493
2 4 21463 21493
2 4 21463 21493
1 4 21494     .
0 4 21494 21509
1 4 21494     .
2 4 21510 21515
2 4 21510 21515
2 4 21510 21515
2 4 21516     .
2 4 21516     .
2 4 21516     .
2 4 21536 21682
2 4 21536 21682
2 4 21536 21682
2 4 21683     .
2 4 21683     .
2 4 21683     .
end
format %td date1
format %td date2