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

Re: st: egen


From   Buzz Burhans <[email protected]>
To   [email protected]
Subject   Re: st: egen
Date   Fri, 31 Jan 2003 12:39:24 -0500

Hi Rodrigo

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.

I make a couple of observations:

I assume that SS1 always takes the values 1 or .
I also note that in your example data from yesterday you show a SS@ with a value of 4 that does not appear consistent with your criteria for assigning a 4???



bysort Household: egen CIVILSUM = sum(SS1) if CIVIL==1
bysort Household: egen CIVILSUM2 = mean( CIVILSUM)
bysort Household: egen Dependants = count( REL) if REL==3
bysort Household: egen Dependants2 = mean( Dependants)
bysort Household: egen MinDepAge = min(AGE) if Dependants2 != .

replace SS2 = 1 if SS1 ==1 & (CIVIL==1 | Dependants2 != .)

replace SS2 = 2 if SS1 == 1 & (REL==3 & AGE >10)

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

replace SS2 =4 if REL<3 & CIVILSUM2<3 & MinDepAge<=5


*drop CIVILSUM Dependants Dependants2 MinDepAge





At 08:52 AM 1/31/03 -0600, Rodrigo Briceno wrote:

Dear friends. Following the procedure asked yesterday I still have doubts:

How can I assign to a wife or husband a value of 3 if the wife or husband
have a SS1 equal to 1. This is a kind of procedure that relates the
condition present in the previous or in the next member of the family:r

rel           ss1  ss2
husband   1     1
wife         .      3 (assigned with procedure)

or

wife          .     3 (assigned with procedure)
husband   1     1


Thanks

Rodrigo



*
*   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/
*
*   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