I'm trying to recode age into groups but this is not working (just takes the first number in the bracket, from what I can tell)
data new;
set have;
if age in (15-24) then agegroup=1;
else if age in (25-54) then agegroup=2;
else if age >= 55 then agegroup=3;
run;
What is the proper way to do this?
Edit: Also I know one can do it the way below, but it is very tedious, especially when there are more than 3 values being made. I'm looking for something easier, with ranges:
IF 15 <= age_tabs <= 24 then agegroup_main = 1;
else if 25 <= age_tabs <= 54 then agegroup_main =2;
else if age_tabs >= 55 then agegroup_main =3;
else agegroup_main = .