Hello-,
I have this data where the observations are in character with colon in the names:
hc_education
Associate's degree
Bachelor's degree
Graduate degree
High school diploma/GED
I attended 12th grade but did not receive a diploma
I completed 10th grade (11 years of school)
I completed 11th grade (12 years of school)
I completed 6th grade (7 years of school)
I completed 9th grade (10 years of school)
I completed high school and graduated or received a GED (13 years of school)
I completed less than 6th grade (less than 7 years of school)
I completed some college or received an associate's degree
I received a bachelor's degree (4 years of college)
I received a graduate degree or studied beyond a bachelor's degree
Less than high school
Some college
Frequency Missing = 9
Some of the observations such as : Associate's degree , Bachelor's degree etc have colon (') before s. Once I apply this code to change this to number:
data first1; set BMII; if hc_education in ('I attended 12th grade but did not receive a diploma','I completed 10th grade (11 years of school)', 'I completed 11th grade (12 years of school)','I completed 6th grade (7 years of school)','I completed 9th grade (10 years of school)', 'I completed less than 6th grade (less than 7 years of school)','Less than high school') then edu=1; else if hc_education in ('I completed high school and graduated or received a GED (13 years of school)','High school diploma/GED', 'Some college')then edu=2; else if hc_education in ('I received a graduate degree or studied beyond a bachelor's degree','Associate's degree','Bachelor's degree','Graduate degree'') then edu=3;
run;
I got error:
104 else if hc_education in ('I received a graduate degree or studied beyond a bachelor's ----------------------------------------------------------- --- ---------- --- 49 49 49 49 - 22 - 76 104! degree','Associate's degree','Bachelor's degree','Graduate degree'') NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended.
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant, a missing value, iterator, (, ), ','.
ERROR 76-322: Syntax error, statement will be ignored.
105 then edu=3;
Please How do I fix this in the code. I cannot change in the Data set.
... View more