It is quite customary to preprocess the data you want to append by filtering out the rows with a key that's already in the base dataset. A simple SQL query should do (untested):
proc sql;
create table newrows as
select * form MyRuleQuery where ID
not in (select distinct IMB_CODE from FinalData);
quit;
proc append base=FinalData data = newrows;
run;
Alternatively you van ceate a unique index on the target table.
PROC DATASETS LIBRARY=yourlib;
MODIFY Finaldata;
INDEX CREATE IMB_CODE / UNIQUE NOMISS ;
quit;
This will reject rows that have a key that is already present. Personally I dislike the (ab)use of a unique index (or actually the associated integrity constraint) as an ETL tool, but is very effective. Apply the unique index just the same as a safety net.
Best of luck,
- Jan.
Hope this helps,
- Jan.
... View more