New SAS user here: I have a dataset (table) created by a PROC SQL statement:
proc sql;
create table work.dm_1 as
select distinct a.subject, c.dsyn as DSYN_DS_1, d.dsyn as DSYN_DS_2
from s_raw.dm_1 a
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
where c.DSYN='NO' and d.DSYN='NO';
quit;
Using the results from this table (work.dm_1), I want to modify another (existing) table (work.edt_ecg, created from a previous procedure) to select matching records (using subject in dm_1 and subjid in edt_eg) from the table in the proc sql above, and to update the table work.edt_ecg. I have tried the following:
proc sql;
update table work.edt_eg as
select *
from work.edt_eg where subjid in (select distinct subject from work.dm_1);
quit;
But its not working for me! Any ideas welcome
left join s_raw.ds_1 c
and then filtering onc.DSYN='NO'
: you loose your observation(1) froma
when there is no matching c. You should writeleft join s_raw.ds_1 c on a.subject=c.subject and c.DSYN='NO'
. The same accounts to your left join ond
– Dirk Horsten