Good. The generalisation to other sets of dummies should be clear. If
there are twenty dummies, a loop may be more congenial:
gen byte whichpet = pet1
qui forval i = 2/20 {
replace whichpet = whichpet + `i' * pet`i'
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of sara khan
Sent: 05 February 2008 22:03
To: [email protected]
Subject: st: Creating a new variable by combining several
Many thanks Nick. I tried your second suggestion, which did exactly
what I wanted.
Regards
Sara
*
* 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/
*
* 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/