Hi Jim,
I am wondering if case and person are actually the only identifiers in your data set because they do not uniquely identify your observations, maybe you should check this with the -unique- command first (if not installed type
-ssc install unique-). Anyway, if they are the only identifiers as you stated in your question, you could try -collape var1 var2 var3, by(case person)-. This, however, will only help if per case and person you have really only one non-missing observation in each variable to be collapsed, as showed in your example. Otherwise, the collapsed mean would be false.
HTH,
Jochen
-------------------------------------------------------------------------------------------
Jochen Späth
Dipl.-Volkswirt
Institut für Angewandte Wirtschaftsforschung (IAW) Tübingen
Ob dem Himmelreich 1
72074 Tübingen
Tel.: +49-(0)7071-9896-14
Fax: +49-(0)7071-9896-99
EMail: [email protected]
IAW-Homepage: www.iaw.edu
-------------------------------------------------------------------------------------------
-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von Jim O'Grady
Gesendet: Donnerstag, 11. Dezember 2008 08:57
An: [email protected]
Betreff: st: Merging observations
Hi Folks,
I'm hoping this is a simple question :)
I have a dataset like this:
Case Person var1 var2 var3
345 01 1 . .
345 01 . 1 .
345 02 . 1 .
345 02 . . 1
I want to merge the observations which have the same identifiers (case
and person) to get
Case Person var1 var2 var3
345 01 1 1 .
345 02 . 1 1
All help appreciated,
Thanks,
Jim
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/