Note that this yields child1, child2, etc., not child01, etc.
Kit Baum
< >
local vns 1100 1600 2100 2600 3100 3600 4100 4600 5000 5400 5800
local i 0
foreach v of local vns {
local i++
gen child`i'HH = (T099`v' == 1)
}
This generates child1HH, child2HH, etc. rather than child01HH,
child02HH.
On Jun 11, 2008, at 02:33 , statalist-digest wrote:
> - ---------------------------------------------
> gen child01_HH=1
> replace child01_HH=0 if T0991100~=1
> gen child02_HH=1
> replace child02_HH=0 if T0991600~=1
> gen child03_HH=1
> replace child03_HH=0 if T0992100~=1
> gen child04_HH=1
> replace child04_HH=0 if T0992600~=1
> gen child05_HH=1
> replace child05_HH=0 if T0993100~=1
> gen child06_HH=1
> replace child06_HH=0 if T0993600~=1
> gen child07_HH=1
> replace child07_HH=0 if T0994100~=1
> gen child08_HH=1
> replace child08_HH=0 if T0994600~=1
> gen child09_HH=1
> replace child09_HH=0 if T0995000~=1
> gen child10_HH=1
> replace child10_HH=0 if T0995400~=1
> gen child11_HH=1
> replace child11_HH=0 if T0995800~=1
> - ------------------------------------------
*
* 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/