Looks like you're trying to recode a variable. First off, you'll need to store the recoded variable in a new variable so you can't set the ridagemn to young/middle/old. You're also mixing types (numbers/characters) but ignore that for now. Second you may have some syntax errors or they're from copying and pasting not sure. Third you need an else if not just and else statement. the following should work: data clean_data; set have; if 0 < ridagemn <= 468 then ridagemn_cat= 'young'; else if 469 < ridagemn <= 648 then RIDAGEMN_cat= 'middle'; else if 649 < RIDAGEMN <= 1080 then RIDAGEMN_cat= 'old' run; To check it run a proc freq on your data. proc freq data=clean_data; tables ridagemn*ridagemn_cat/missing; run; If the variable is continuous you want to check what happens at the boundaries (specifically at 648, 649 and 648.5).
... View more