Update SAS dataset based on results from a PROC SQL from another dataset -


new sas user here: have dataset (table) created proc sql statement:

proc sql;     create table work.dm_1     select distinct a.subject, c.dsyn dsyn_ds_1, d.dsyn dsyn_ds_2     s_raw.dm_1     left join work.edt_eg b     on a.subject=b.subjid     left join s_raw.ds_1 c     on a.subject=c.subject     left join s_raw.ds_2 d     on a.subject=d.subject     c.dsyn='no' , d.dsyn='no'; quit; 

using results table (work.dm_1), want modify (existing) table (work.edt_ecg, created previous procedure) select matching records (using subject in dm_1 , subjid in edt_eg) table in proc sql above, , update table work.edt_ecg. have tried following:

proc sql;    update table work.edt_eg    select *     work.edt_eg subjid in (select distinct subject      work.dm_1);  quit; 

but not working me! ideas welcome

you should either create new table or view subset of data need

create view work.edt_eg_wanted select *  work.edt_eg  subjid in (select distinct subject work.dm_1);  

or delete unwanted observations (1) existing table

delete *  work.edt_eg  subjid not in (select distinct subject work.dm_1);  

(as did not supply sample data, code not tested)

(1) observation word sas uses row in table. because sas written statisticians.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -