Page 1 of 1
Dummy with multiple options
Posted: Fri Jul 25, 2014 10:52 am
by celeste.uantwerpen
Hi! I need to create a dummy variable for several group ages. I have the following set (of ages)
15-24
25-35
35-44
45-54
55-64
>65
I would like to make them "1" if they are in the age category 15-24 OR 25-35 OR 35-44, and 0 if not. How can I do that?
Thank you so much!
Celeste
Re: Dummy with multiple options
Posted: Fri Jul 25, 2014 12:03 pm
by startz
Hi! I need to create a dummy variable for several group ages. I have the following set (of ages)
15-24
25-35
35-44
45-54
55-64
>65
I would like to make them "1" if they are in the age category 15-24 OR 25-35 OR 35-44, and 0 if not. How can I do that?
Thank you so much!
Celeste
or
Code: Select all
series dummy = (age>=15 and age<=24) or(age>=25 and age<=44) or (age>=35 and age<=34)
Re: Dummy with multiple options
Posted: Fri Jul 25, 2014 12:42 pm
by celeste.uantwerpen
Hi! Thank you for your answer. However I get this message:"Numeric Operator applied to string data".
Any ideas on what I should do?
Thanks again!
Celeste
Re: Dummy with multiple options
Posted: Fri Jul 25, 2014 12:44 pm
by startz
Probably something like
series dummy = age = "15-24"
etc.