Hello - I have a basic question I can't seem to figure out. I have a dataset with IDs and a test conducted multiple times per ID. I want to 1) view and 2) eliminate all IDs for which I have one or fewer test values. Here are the results of a proc freq.
Using SAS Studio/University.
Thank you!
Anissa
Thank you Reeza! I will try tonight and let you know if it works. I really appreciate it. Especially as it is clear I could have asked the question more precisely. Definitely still on the early part of the SAS learning curve!
Thank you very much for your reply!. I had posted a screenshot but SAS removed it for improper format!. Here it is.
What I mean is I want to "see" a list of all USUBJIDs for which I have 1 test or fewer and then I want to eliminate these from my dataset*. I hope this helps. Thanks again!
Assuming you can count records based on ID this may work though.
proc sort data=have;
by ID;
run;
data single multiple;
set have;
by id;
if first.id and last.id then output single;
else output multiple;
run;
This will write all the records that occur only once to the a data set called single and multiple records to the data set multiple. If that doesn't work, please elaborate on your issue.
@anissak1 wrote:
Thank you very much for your reply!. I had posted a screenshot but SAS removed it for improper format!. Here it is.
What I mean is I want to "see" a list of all USUBJIDs for which I have 1 test or fewer and then I want to eliminate these from my dataset*. I hope this helps. Thanks again!
Thank you Reeza! I will try tonight and let you know if it works. I really appreciate it. Especially as it is clear I could have asked the question more precisely. Definitely still on the early part of the SAS learning curve!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.