austin:
as a beginner I don't know whether it is common to send thank-you-mails.
anyway: many thanks for your help!
best,
katy
austin nichols <[email protected]>
I sincerely doubt your variable names have spaces in them, so I will
assume they are named v1, v2, etc. up to v99 and have labels "poor
performance", "retirement", etc. assigned via the -label var v1 "poor
performance" command.
Then you can
gen byte onevar=.
forval i=1/99 {
local l: var la v`i'
la def onevar `i' "`l'", modify
replace onevar=`i' if v`i'==1
}
la val onevar onevar
tab onevar
and if you really need a string variable, you can
decode onevar, gen(onestrvar)
-----Original Message-----
From: Katarina Sikavica [mailto:[email protected]]
Sent: Friday, July 22, 2005 9:19 AM
Subject: Re: st: Categorical variable
actually: I've collected data on reported reasons for CEO turnover (as
stated in newspaper articles); my dummy variables look like this:
- poor performance (1/0)
- retirement (1/0)
- policy differences (1/0)
- ....
Now I would like to create a single new variable called "reason" that
looks like this:
one and only variable "reason" coded as follows:
1 poor performance
2 retirement
3 policy differences
4 ....
best,
Katy
*
* 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/