Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Stas Kolenikov <skolenik@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Alternative to -collapse-? |
Date | Tue, 23 Jul 2013 08:17:22 -0500 |
How much of the -by- operations are you familiar with? If not much, start off with http://www.stata-journal.com/article.html?article=pr0004 and see if that helps. -- Stas Kolenikov, PhD, PStat (ASA, SSC) -- Senior Survey Statistician, Abt SRBI -- Opinions stated in this email are mine only, and do not reflect the position of my employer -- http://stas.kolenikov.name On Tue, Jul 23, 2013 at 8:10 AM, Lukas Borkowski <570722@soas.ac.uk> wrote: > 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/ * * 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/