[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: looping
On Mar 20, 2006, at 9:42 AM, n j cox wrote:
You should read some basic accounts of -by:-.
Sorry about the ambiguity. I did forget my audience. I am working
with a special sample from the 2000 United States Census called the
longform. It is a sample of households - I think approximately 5% of
the US population received the survey. An observation is a
household, but since only 5% of all households were sampled, you must
use the person weights (-perwt-) when working with this data. So,
for instance, if a certain household is sampled and they represent 5
households, then the perwt=5. Males and females are numeric values.
Also, please note the advice in the Statalist FAQ:
"Statalist is an international list. Please explain details that
may make sense only in your own corner of the world."
Some of the details here presuppose knowledge of your local
situation, which I guess to be the United States. It is likely that
many members of Statalist do not know what "msa" means, for example.
I am still in the dark on what an observation in your dataset
looks like, or what it represents. I assume that -males- and -
females- are numeric variables, but are they dummies or do they
counts? In either case, what is -perwt- precisely?
I've been using egen to sum males and females, but was unsure of how
to implement the looping over all US county variables. This is where
-by county- wouuld come in, correct?
Either way, I guess that -egen, total()- with heavy use of -by()-
or -by:- is the easiest way to get totals of males and females,
after which you get ratios directly. It should take about 3 lines
of Stata. The only looping would be that tacit in -egen-.
* For searches and help try: