Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: AW: RE: AW: AW: creating a count variable


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: AW: RE: AW: AW: creating a count variable
Date   Tue, 18 May 2010 17:43:20 +0100

Jane said how many observations. Whether that's what she really wants if
there are missings is indeed a question which she may answer. 

Specifically in this example a hospital with no known location seems a
little implausible. 

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

" 
bysort home : gen howmany = _N 

seems to be an answer to the question."

We could get started now on the "missing" issue, but Jane will find
plenty
of material on it in the archive...

Nick Cox

If you like, but 

bysort home : gen howmany = _N 

seems to be an answer to the question. 

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

Or rather, to create a variable, as your subject line indicates, use
-egen,
count- with the -by- prefix.

Martin Weiss

Combine -count- with the -by- prefix.

Jane Suiter

This is very simple but I keep getting it wrong. I have data with
large number of observations (hospitals) and I need to generate a count
variable
of how observations are in each geographic area. The variables are idno
for
the facility, home for the location of the facility.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index