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!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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