Sara asked:
1. I have an unbalanced panel and wish to create a variable that
identifies the presence of wave 1 respondents in subsequent waves in
order to test for attrition.
2. I wish to distribute the value of wave 1 dependent variables in the
unbalanced panel over subsequent waves.
+-----------------+
pid wave wave1
-----------------
1. 10016872 2 0
2. 10016872 4 0
-----------------
3. 10017992 1 1
4. 10017992 2 1
5. 10017992 3 1
6. 10017992 4 1
7. 10017992 6 1
-----------------
00040404 2 0
-----------------
19. 10040439 1 1
20. 10040439 2 1
-------------------------------------------------
This does it:
recode wave(1=1)(*=0) , generate(wave1)
by pid, sort: egen wave2=max(wave1)
Good luck
Svend
__________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: [email protected]
__________________________________________
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/