I've seen two methods: 1) create a separate table to house the new records and then append proc sql; create table work.recs_to_add as select distinct 'C1' as site, 123 as value from test t1 where not exists (select * from work.test where site='C1'); insert into test(site,value) select site,value from work.recs_to_add; quit; or 2) create a temp variable as part of a data step: data test; set test end=eof; retain tmpSite; format tmpsite $1.; if _N_=1 then tmpSite='N'; if site='C2' then tmpsite='Y'; output; if eof and tmpsite='N' then do; site='C1'; value=123; output; end; run;
... View more