Hi, I agree that a merge statement should work in this situation, but please be aware that the in= data set option "Creates a variable that indicates whether the data set contributed data to the current observation" - from the documentation. So in the merge statement data set options, T1 and T2 are just variables, they are not like the table alias names specified in the proc sql code. Further the put statement is not used to output data to a SAS data set, for that in your code you should use the output statement along with the data set name you want to output to, e.g.: DATA MASTER_NEW /* WEEKLY_NEW */; MERGE MASTER (IN=T1) WEEKLY (IN=T2); BY APPLICATION_ID; /* IF T1 AND T2 THEN OUTPUT WEEKLY_NEW; */ IF T1 AND NOT T2 THEN OUTPUT MASTER_NEW; RUN; I was not sure if you wanted a WEEKLY_NEW data set, if you do then you can just remove the comment markers "/*" and "*/". hth. Regards, Amir. Message was edited by: Amir Malik - minor correction.
... View more