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

Re: st: Replacing missing household-level id #'s for individualhousehold members


From   Chris Rohlfs <car@uchicago.edu>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Replacing missing household-level id #'s for individualhousehold members
Date   Thu, 27 Mar 2003 09:53:40 -0600 (CST)

rick,

if i understand you right & the data are already sorted in this way, then
type this command once:

	replace hid = hid[_n-1] if hid==.

and it will fill in all the missing values.

chris

On Mon, 24 Mar 2003, Rick Tardanico wrote:

> Greetings,
> 
> In long format, I have data on 1000+ individual members (hmem) of 200 
> households.  For each household, the household id variable (hid) 
> includes an id-# for the first member only, as follows:
> 
> hid hmem
> 1      1
> .       2
> .       3
> 2      1
> .       2
> 3      1
> .       2
> .       3
> .       4
> .       5
> 
> For each household member (hmem), I need to replace the missing 
> household  id-# (hid) with the corresponding id-#.  My attempts so far 
> have failed.  Would someone be able to clue me in on where I'm going wrong?
> 
> Thanks,
> Rick
> 
> *
> *   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/
> 


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