Hi SAS Community, First off, my apologies if I do not include enough/the correct information - this is my first post on this site. Happy to receive feedback on how I can improve my "question asking". I have >1million subject IDs - each subject ID is 20 characters - in a CSV file. I have a proc sql block that pulls from a "master table", but I want to ONLY pull in the rows where the subject ID in the "master table" ALSO exists in the CSV file. It is a single column (see screenshot). I'd like to use a WHERE statement in the proc sql block to accomplish this, but of course open to other methods. I have tried a few different methods, such as saving the entire csv as a ".mac" file and assigning it to a macro, but I got an error indicating the macro couldn't hold all the info I was trying to shove into it. Here is what I have most recently tried: proc import
file = "blah blah file path"
out = master_patid
dbms = csv
replace;
run;
proc sql;
create table tablename as
select a.subid, a.diag, b.subid, b.drg, b.fst_dt
from source.&dataset. a left join source.&dataset. b
on a.subid=b.subid
where subid in (master_patid));
The error I get in my log file says "Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant," My hunch is that it is not seeing the csv file as a list - but I haven't been able to figure out how to do so. I appreciate you taking the time to help me out!
... View more