BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anissak1
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
anissak1
Obsidian | Level 7

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!

View solution in original post

5 REPLIES 5
Reeza
Super User
How can you have fewer than one test value? Is that indicating a missing data? It helps if you can provide some examples of what you have and what you want as your output.
anissak1
Obsidian | Level 7

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!

 

Reeza
Super User
Sorry, can't download attachments.
Reeza
Super User

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!

 


 

anissak1
Obsidian | Level 7

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!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1191 views
  • 0 likes
  • 2 in conversation