Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Thomas, Anthony" <anthony_h_thomas@brown.edu> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: summing and reshaping the data |
Date | Tue, 11 Mar 2014 10:59:24 -0400 |
Hi Sara, It sounds like you should look at -collapse- instead of egen. Try "help collapse" On Tue, Mar 11, 2014 at 10:55 AM, Sara Neto Machado <mail@saramachado.com> wrote: > Dear all, > > company--workers----V1 > 10---------------6---------10 > 10---------------3---------10 > 10---------------1---------10 > 11---------------3----------3 > 15--------------10---------21 > 15--------------11---------21 > 18---------------5----------5 > > What I pretend to do is to sum up the number of workers for each > company but without any values repeating, namely, company numbers > should not repeat. To do the sum I have computed this straigthforward > comand: > > egen V1 = sum (workers), by (company) > > the latter generated the column V1 but I do not manage to find a way > to not repeat the number of company and the V1 numbers that refer to > the same company. For instance, company 10 continues to have 3 > separated lines saying the same total. How do you manage to this two > simultaneous things? What is the most efficient way to not repeat > number of company and the correspondent lines in the V1 column? > > thanks in advance for whom responds to this inquiry > Regards, > Sara > * > * 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/