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

How would I list the missing values of a particular variable?

 

for instance how would I list subject IDs (Variable is ID-numeric variable) who have missing cholesterol values (variable col-numeric variable) in sas code?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Getting a list is easy:

 

proc print data=have;

   where cholesterol = .;

   var subject_id;

   title 'IDs for subjects who are missing Cholesterol measurement';

run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Questions like this is a lot easier to answer if you show us some example data to work with 🙂

 

Are there multiple observations for the same ID? And should the ID have all missing cholesterol values or is a single missing enough?

mariamon0
Fluorite | Level 6

There were many different variables that the subject IDs have. Im only looking to see if the subject IDs (there are over 500) are missing cholesterol values. There is only one single cholesterol value for each subject ID. I would like a list of all subject Ids with missing cholesterol values. 

Reeza
Super User

Add a filter using a WHERE statement. 

 

For example:

 

data want;
set sashelp.heart;
where missing(deathCause); *filter for only records with missing deathCause;
keep _all_; *keep only variables of interest;
run;

@mariamon0 wrote:

There were many different variables that the subject IDs have. Im only looking to see if the subject IDs (there are over 500) are missing cholesterol values. There is only one single cholesterol value for each subject ID. I would like a list of all subject Ids with missing cholesterol values. 


 

Astounding
PROC Star

Getting a list is easy:

 

proc print data=have;

   where cholesterol = .;

   var subject_id;

   title 'IDs for subjects who are missing Cholesterol measurement';

run;

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
  • 4 replies
  • 1447 views
  • 2 likes
  • 4 in conversation