06-12-2017 04:04 PM
06-12-2017 05:48 PM
This paper walks through how to recode variables using a format. It's well written and clear.
Another standard way to recode is IF/THEN statements.
06-13-2017 01:00 AM
C1 is your variable name, so you want to rename your variables.
You'll need something like:
data WANT; set HAVE(rename=(C1=CUSTOMER1 B1=CUSTOMERB) ); RESULT=(CUSTOMER1 ='Y' & CUSTOMERB='N' ); run;
06-13-2017 09:41 PM
Your explanations were not clear. Always show : this is what I have & this is what I want.
data WANT; length RESULT $1000; RESULT= "(C1='y' and b1='N' and a1='y')" ; RESULT=transtrn(RESULT,'C1=','CUSTOMER1='); RESULT=transtrn(RESULT,'b1=','CUSTOMERB='); putlog RESULT=; run;
RESULT=(CUSTOMER1='y' and CUSTOMERB='N' and a1='y')
Don't forget to make your string longer.