06-25-2017 07:11 PM - edited 06-25-2017 07:13 PM
I want to create a new variable based on specidif conditions. If the conditions are met, I want that new variable to carry the value that is in a different variable:
IF (ROLE_IN_REFERRAL = 'x' or ROLE_IN_REFERRAL = 'y' or ROLE_IN_REFERRAL = 'z') THEN AGE_AT_RFRL_CHLD = use the value(in this case the age) that is in variable: (age_at_referral)
ELSE AGE_AT_RFRL_CHLD = . ; run;
06-25-2017 07:20 PM
This is pretty straightforward, but two questions first:
1. Which SAS environment are you trying to do this in (Base SAS, Enterprise Guide, DI Studio, ...).
2. It looks like ROLE_IN_REFERRAL is character, and age_at_referral and AGE_AT_RFRL_CHILD are both numeric. Please confirm.
06-25-2017 07:25 PM
I work with SAS9.4
and yes ROLE_IN_REFERRAL is character, and age_at_referral and AGE_AT_RFRL_CHILD are both numeric
Need further help from the community? Please ask a new question.