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
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.