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

RE: st: egen


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: egen
Date   Fri, 31 Jan 2003 17:49:57 -0000

Buzz Burhans
> 
> I think this will reassign SS2 according to your desired 
> criteria, but 
> don't use it without testing it and the results.  Make 
> absolutely sure it 
> gives you the correct reassignments, I haven't tested it 
> very carefull 
> against your criteria and sample data.

<snip> 

Watch two details among many others. 
 
> bysort  Household: egen Dependants = count( REL) if REL==3

Note that this kind of statement _excludes_ observations
for which REL != 3. This is not what you want _if_ the 
intention is to see whether any other members of the family 
have REL equal to 3. 

> replace SS2 = 3 if SS1 ==. & (CIVIL==1 & CIVILSUM==1 & 
> Dependants2 != .)

The habit of writing 

!= . 

is going to become dangerous as you move to Stata 8 
and make use of missing values .a to .z. The habit 
to learn for not missing is 

< . 
 
Nick 
[email protected] 


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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