hi again,
thanks a lot for answering this quickly .... and sorry for the imprecision (I just subscribed to statalist :-))
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
Richard Williams <[email protected]>
At 02:43 PM 7/22/2005 +0200, Katarina Sikavica wrote:
>Hi Alice,
>hi all,
>
>I have the same problem.... in addition to the below question I would like
>to know whether and how I can generate a string variable out of say 3 or
>more dummy variables.
>
>cheers,
>Katy
Katy, could you be more specific as to what you have in mind? Anyway, one
way might be
gen x = 100 * dummy_1 + 10 * dummy_2 + dummy_3
tostring x, gen(xstring)
I suspect that isn't what you have in mind though, e.g. maybe you want a
string variable with values like "high" "medium" "low" ? Perhaps something
like
. gen y = "high" if dummy_1 == 1
. replace y = "medium" if dummy_2 == 1
. replace y = "low" if dummy_3 == 1
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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/