Hi, I am trying the following code and can some one let me know where this is going wrong? I am trying to compare all the terms from AE and with the ' if ' condition display the output as NEW/NO CHANGE/UPDATED. data final;
merge der1_ (in=a) der4_ (in=b) ied (in=c) dmr (in=d) rfr(in=e);
by UNOSID;
if b;
keep SUBJECT AETERM AESEV AESER YESREAS AEREAD AEINTROP AEREL AEANT AESTDAT_ AEENDAT_ AEACN AEACNSP AEOUT LPSDAT_ PULREL AEYES AECM TDDAT_ TDDAYS SEX_D DTHDAT_ AGE_D DTHCAU DTHCAUSP ARREST HOSPDDAT_ DDIS RRINDIC RRINDOT RRCINDIC RFHEPC RFCANCER SEX AGE MELD INC4 EAD;
run;
proc sort data=final NODUPKEY;
by _ALL_;
RUN;
proc sort data=final out=c_final ;
by SUBJECT;
run;
proc sort data=previous.final out=o_final(rename=(AETERM =o_AETERM AESEV=o_AESEV AESER=o_AESER YESREAS=o_YESREAS AEREAD=o_AEREAD
AEINTROP=o_AEINTROP AEREL=o_AEREL AEANT= o_AEANT AESTDAT_=o_AESTDAT_ AEENDAT_=o_AEENDAT_
AEACN=o_AEACN AEACNSP=o_AEACNSP AEOUT=o_AEOUT LPSDAT_=o_LPSDAT_));
by SUBJECT;
run;
/* Create a new dataset with the new variable STATUS.
STATUS is reflected in the output as NO CHANGE, UPDATED accordingly*/
data current.final;
attrib STATUS length=$25.;
merge c_final(in=a) o_final(in=b keep=SUBJECT o_AETERM o_AESEV o_AESER o_YESREAS o_AEREAD o_AEINTROP o_AEREL o_AEANT o_AESTDAT_ o_AEENDAT_ o_AEACN o_AEACNSP o_AEOUT o_LPSDAT_);
by SUBJECT;
if a and b then do;
if ((AETERM = o_AETERM , (AESEV=o_AESEV , (AESER=o_AESER , (YESREAS=o_YESREAS , (AEREAD=o_AEREAD, (AEINTROP=o_AEINTROP, (AEREL=o_AEREL, (AEANT= o_AEANT, (AESTDAT_=o_AESTDAT_, (AEENDAT_=o_AEENDAT_, (AEACN=o_AEACN, (AEACNSP=o_AEACNSP, (AEOUT=o_AEOUT, (LPSDAT_=o_LPSDAT_ ))))))))))))))) then do;
Status='No Change';
end;
if (AETERM ne o_AETERM, (AESEV ne o_AESEV, (AESER ne o_AESER, (YESREAS ne o_YESREAS, (AEREAD ne o_AEREAD, (AEINTROP ne o_AEINTROP, (AEREL ne o_AEREL, (AEANT ne o_AEANT, (AESTDAT_ ne o_AESTDAT_, (AEENDAT_ ne o_AEENDAT_, (AEACN ne o_AEACN, (AEACNSP ne o_AEACNSP, (AEOUT ne o_AEOUT, (LPSDAT_ ne o_LPSDAT_)))))))))))))) then do;
if a ne b then do;
Status='Updated';
end;
if a and not b then do;
Status='New';
output;
end;
run; This error is popping up. Any help is appreciated. ! (AEACNSP=o_AEACNSP, (AEOUT=o_AEOUT, (LPSDAT_=o_LPSDAT_ )))))))))))))) then do; ERROR 22-322: Syntax error, expecting one of the following: (, [, {. ERROR 76-322: Syntax error, statement will be ignored. Thank you, Regards, Nasya
... View more