Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Abhimanyu Arora <abhimanyu.arora1987@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: -collapse- command |
Date | Wed, 16 Jun 2010 18:14:59 +0200 |
I see, thanks very much, Neil. Best regards Abhimanyu On Wed, Jun 16, 2010 at 5:39 PM, Neil Shephard <nshephard@gmail.com> wrote: > On Wed, Jun 16, 2010 at 3:32 PM, Abhimanyu Arora > <abhimanyu.arora1987@gmail.com> wrote: >> Dear statalist >> >> I have 4 variables country, year,type of riot, no. of riots and would >> like to finally have country, year, riots where riots are sum across >> all types. >> I tried using collapse country city (sum) riots, by (year) but get a >> type mismatch error. Any suggestions? > > collapse (sum) total_riots=riots, by(country year) > > If you also have 'city' and want it by that as well then > > collapse (sum) total_riots=riots, by(country city year) > > See -man collapse- for the full syntax for the -collapse- command. If > you don't understand the syntax diagram then read -man language-. > > > Neil > > > -- > "... no scientific worker has a fixed level of significance at which > from year to year, and in all circumstances, he rejects hypotheses; he > rather gives his mind to each particular case in the light of his > evidence and his ideas." - Sir Ronald A. Fisher (1956) > > Email - nshephard@gmail.com > Website - http://slack.ser.man.ac.uk/ > Photos - http://www.flickr.com/photos/slackline/ > * > * 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/