I need to compare two variables in two different data-sets which has different names for the variables, then i need to write the observations in SASYES if the records match else write it to SASNO.
I am retrieving the records from DB2 and renaming the variables.
my sas code
DATA _NULL_;
SET WORKLIST;
SET UNITFUNC;
IF PRIMNUM=CORRPMNM AND MODELCD=MCMODEL THEN DO;
FILE SASYES;
PUT @01 ANSFACT1 $CHAR7.
@09 CORRPMNM $CHAR12.
@21 MCMODEL $CHAR8.
OUTPUT SASYES;
END;
ELSE DO;
FILE SASNO;
PUT @01 ANSFACT1 $CHAR7.
@09 CORRPMNM $CHAR12.
@21 MCMODEL $CHAR8.
OUTPUT SASNO;
END;
RUN;
When i submit the code, all the observations are written to SASNO
even when they are few matching observations in both the data-sets. Please help me.
Note: I have had used MERGE
also to read the data from two tables, the result is same.
Can anyone help ?
WORKLIST
andUNITFUNC
, that includes at least one example of when it works as you expect and at leas one example of where it does not. – D. Josefsson