Statalist


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

st: Generating multiple variables


From   "Georgiana Bostean" <gbostean@uci.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Generating multiple variables
Date   Wed, 5 Sep 2007 13:52:28 -0700 (PDT)

Hi. I would like to generate and code multiple variables with similar
names (beginning with limitdur*) based on multiple variables with similar
names. The laborious way to do it is:

generate limitdur1=0
replace limitdur1=lhcaly1 if ladura1 == .
replace limitdur1=ladura1 if lhcaly1 == .

generate limitdur2=0
replace limitdur2=lhcaly2 if ladura2 == .
replace limitdur2=ladura2 if lhcaly2 == .

generate limitdur3=0
replace limitdur3=lhcaly3 if ladura3 == .
replace limitdur3=ladura3 if lhcaly3 == .

and so on...

Is there an easier way to do this?

Thank you in advance!




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