sas - update a table efficiently using proc sql -
i need update table past missing information using past versions of same table. update needed earlier information not available anymore in recent table. let tablea table @ time0 , tableb table @ time1 , on. i'm interested in last updated table.
so far have tried method;
create view _tableb select * tablea union select * tableb a.id not in (select id tablea);
then proceeded with:
create view _tablec select * _tableb union select * tablec a.id not in (select id _tableb);
and on till reach final table create table.
create table _tablet select * _tables union select * tablet a.id not in (select id _tables);
do see better here?
p.s: have mention each observations can have many languages. information in way
id|lguage1|lguage2|lguage3|
and put wide2long using view , this method.
id1|lguage1 id1|lguage2 id1|lguage3 id2|lguage1
the informations not sorted id , language.
thanks.
given couple of assumptions, can simplify greatly:
1. each individual dataset has no duplicate id's.
2. each dataset sorted id.
then this: data result; set _tables ... _tablec _tableb _table; id; if first.id; run;
this way, code more compact , data read once. read in tables , output interweaved result (i.e.: result sorted on id)
the firs.id filter means keep first record of each id value encounters. since datasets mentioned recent first, take recent record available each id , ditch others.
Comments
Post a Comment