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/