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

st: RE: question for hierarchical (i.e. hh & person) file


From   austin nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: question for hierarchical (i.e. hh & person) file
Date   Fri, 7 Oct 2005 10:27:33 -0400

All one step:
. collapse (max) X1, by(UIDhhstr)

-----Original Message-----
From: F V [mailto:fv020@yahoo.com]
Sent: Thursday, October 06, 2005 1:59 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: question for hierarchical (i.e. hh & person) file

I have a very large data-set (i.e. around 60,000
households, and around 320,000 individuals). say that
i have three variables: a hh identifier, a person
identifier, and an X1 variable of interest that
measures whether a person is X1 or not.

UIDhhstr	X1	UIDpersonstr
01101021	1	0110102101
01101021	0	0110102102
01101021	0	0110102103

say I wanted to tell Stata: gen a variable X2 such
that it takes the value of 1 if for any member of a
household X1==1. how can i do this in stata? after
generating X2, then i could collapse the data down to
the household level.

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