Statalist


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

st: Re: program for similar commands


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: Re: program for similar commands
Date   Wed, 11 Jun 2008 06:56:50 -0400

< >

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.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index