Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Alternative to -collapse-?
From
Lukas Borkowski <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Alternative to -collapse-?
Date
Tue, 23 Jul 2013 15:10:27 +0200
Dear list,
I am using Stata 12 and currently clean up a dataset that will become a panel dataset. The quality of the dataset is quite poor (originates from a survey) and I face multiple (endless) situations where values to the same questions are recorded in different variables. The tricky situations that I need to sum these values across rows and columns on a household level. The structure looks somewhat like this simplified example:
id v1 v2 v3
1 . . 2
1 . 7 .
1 9 . .
2 4 . 1
2 . 7 .
2 7 . .
...
I would like to generate a variable v4 that sums v3 on a household level. I currently use -collapse (sum) v3, by(id)- but this is obviously a real pain as I would have to merge all the resulting micro datasets.
Do you have any suggestion what I could do?
Thank you very much for your help!
Best,
Lukas
#
Lukas Borkowski
University of London, School of Oriental and African Studies (SOAS)
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/