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
0 Response to Change repeated obs. within id
Post a Comment