Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: assigning household characteristics toan individual with missing values


From   "Ms. Marilyn Ibarra" <[email protected]>
To   [email protected]
Subject   st: Re: assigning household characteristics toan individual with missing values
Date   Wed, 1 Mar 2006 14:03:31 -0500

I have the following:

Household ID     Relationship     Remits
1                   father          1
1                   mother          1
1                   son             1
2                   father          .  
2                   mother          . 
2                   son             . 
3                   father          0  
3                   mother          0
3                   daughter        1

I would like to create a Remit_hh varible that tells me if 
the head of household (we can assume it is always father for 
this simple example) receives remittances.  Remits takes on 
the value of 1 when the person receives and zero if they do 
not receive.  

I tried the following: 

generate remits_hh=remits if relationship==father
by hhid: replace remits_hh=sum(remits_hh)

It creates a problem where there are missing values, it 
places a 0.  I guess I can then say: 

replace remits_hh=remits if remits==. 

but is there a better way to get at this than having to do 
the third command to all my variables that have missing 
values.

Marilyn. 


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