Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: multiple means by state

From   "Millimet, Daniel" <>
To   "" <>
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
Dallas, TX 75275-0496
phone: 214.768.3269
fax: 214.768.1821

-----Original Message-----
From: [] On Behalf Of Jared JS Olesen
Sent: Wednesday, February 16, 2011 12:41 PM
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:

*   For searches and help try:

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