Hello Everyone,
I have a large list of patient records (over 100k). After some initial analysis I have come up with a list of 1720 patient ID's that need to be removed from the list. Any suggestions as to how to go about this without writing the following 1720 times?
if patient_id = (patient_id) then DELETE;
Any thoughts would be much appreciated.
Thanks so much
Merge the two files, but only keep those IDs which aren't in both files.
Art, CEO, AnalystFinder.com
Merge the two files, but only keep those IDs which aren't in both files.
Art, CEO, AnalystFinder.com
This worked like a charm.
Thanks so much!
For anyone looking to use this solution, you can find instructions on how to merge tables while only keeping the records that don't match here:
http://support.sas.com/kb/40/414.html
Thanks again.
Rightcoast.
Art has the best idea, if the patient IDs to be removed are somehow indicated in a SAS dataset. But you didn't say that the information was in the dataset, you said you have a list ... somehow you have to either type the patient IDs as follows:
if patient_id in (2300091,2300392,2407702, ...) then delete;
/* and don't make any typographical errors */
Or otherwise find a way to indicate these 1720 patient IDs
Use SQL NOT IN
Assuming your full dataset is A and your partial dataset is B,
proc sql;
create table want as
select *
from table a
where id not in (select id from b);
quit;
@righcoastmike wrote:
Hello Everyone,
I have a large list of patient records (over 100k). After some initial analysis I have come up with a list of 1720 patient ID's that need to be removed from the list. Any suggestions as to how to go about this without writing the following 1720 times?
if patient_id = (patient_id) then DELETE;
Any thoughts would be much appreciated.
Thanks so much
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.