Bookmark and Share

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: RE: multiple means by state


From   "Millimet, Daniel" <millimet@mail.smu.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: multiple means by state
Date   Wed, 16 Feb 2011 18:45:42 +0000

1.  create a loop using foreach after defining the 50 variables in a local such as -local vars "x1 x2 ... x50"

2.  just collapse the data and create state-level means and then summarize

	collapse (mean) x1 x2 ... x50, by(state)

    is the syntax I believe.

****************************************************
Daniel L. Millimet, Professor
Department of Economics
Box 0496
SMU
Dallas, TX 75275-0496
phone: 214.768.3269
fax: 214.768.1821
web: http://faculty.smu.edu/millimet
****************************************************

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jared JS Olesen
Sent: Wednesday, February 16, 2011 12:41 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: multiple means by state

I've got county level data on many variables, also coded by state.  I'd
like Stata to report the mean of each US state on nine of those variables
using one command... that is, without typing out 50 separate commands for
each separate variable.  Please help!


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index