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: foreach? forvalues? |
Date | Mon, 4 Jun 2012 14:06:17 +0200 |
depending on your requirements, you could also have a look at -collapse- On Mon, Jun 4, 2012 at 2:03 PM, Maarten Buis <maartenlbuis@gmail.com> wrote: > On Mon, Jun 4, 2012 at 1:55 PM, Alberto R Osella wrote: >> I'd like to obtain , say, the mean of Score for each combination of Time And >> Diet: > > *------------ begin example --------------- > clear > input Time Diet Score > 0 1 3.5 > 3 1 2.8 > 6 1 2.5 > 0 2 4.5 > 3 2 4.2 > 6 2 3.9 > end > > // method 1 > table Time Diet, c(mean Score) > > // method 2 > bys Time Diet : egen m_score = mean(Score) > list > *------------- end example ---------------- > (For more on examples I sent to the Statalist see: > http://www.maartenbuis.nl/example_faq ) > > Hope this helps, > Maarten > > -------------------------- > Maarten L. Buis > Institut fuer Soziologie > Universitaet Tuebingen > Wilhelmstrasse 36 > 72074 Tuebingen > Germany > > > http://www.maartenbuis.nl > -------------------------- > * > * 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/