I have several cross-sections of household data at different times, which have the same variables and have some common participants between them, who are identified with a unique number. The format of each dataset is as follows:
Uniquenum var1 var2 var3 period
1 32 ... 1
2 .......... 1
4 .......
And then for the second dataset
Uniquenum var1 var2 var3 period
2 67 ... 2
3 .......... 2
4 .......
and so on. I need to combine these cross-sections into a panel in which the people who appear in more then more cross-section (identified by their unique numbers appearing in more than one cross-section) are retained and their values of the variables are kept in a panel format (ie with the value of var1 for period 1, period 2 etc), i.e. perhaps as follows or something similar:
Uniquenum var1 var2 var3 period
2 32 ... 1
2 67 .......... 2
4 ....... 1
4 ..... 2
I have tried -merge-, -append-, and -joinby- with various specifications but am not getting the desired result. For example, I get outcomes in which for the common people, the variable values from the master dataset are retained and the only addition from the second dataset are the 'new' people, or where the outcome is not a panel. I have tried formatting each dataset as a panel before combining them, and specifying period as the time variable and uniquenum as the cross-sectional identifier, but still no luck. I have read the relevant FAQ and also searched the archive but am not getting the correct approach - perhaps what I am asking is too simple to have been asked before. Any suggestions would be much appreciated.
best,
Gisella
*
* 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/