Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: counting

From   Christopher F Baum <[email protected]>
To   [email protected]
Subject   st: Re: counting
Date   Sat, 7 Feb 2004 08:25:58 -0500

On Feb 7, 2004, at 2:33 AM, Amit wrote:

Suppose I have 5 states and I want to count the number of children in each
state. How can I do this without generating a new variable. If I do

by state: count if child==1

then r(N) only stores the last state's result.
tabstat child, stat(N) by(state)

Not knowing more about your data, I don't know if this will actually do what you want. But some variation on it should. For instance, if your observations are on counties that are part of states, and each county has a variable recording the number of school-age children, then aggregating to the state level would be done with stat(sum). If you Read The Fine Manual (or even the on-line help) you may find it quite useful in this regard.


* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index