02-29-2012 12:51 AM
proc sort data=dataset1;
proc sort data=dataset2;
merge dataset2 (in=a)
Is this overwriting the existing dataset2, and applying the merge operation ?
02-29-2012 02:12 AM
According to your code it will overwrite the dataset2 and keep the variables and of data in variable ID if existing in both datasets or if not existing in dataset1 and keep osb existing in dataset2
02-29-2012 07:52 AM
Vish33 and manojinpec,
If the 'LEFT JOIN' you mentioned is the SQL LEFT JOIN, then you were wrong. SQL LEFT JOIN will keep the value of first table instead.
02-29-2012 08:45 AM
Yes, the source dataset2 (the one in the merge statement) will be replaced by the same named target data set (the one in the data statement) in case the data step finishes without errors.
A SAS merge is not the same like a SQL join because a SAS merge statement behaves differently to a SQL join in case of many-to-many relationships.