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?
Getting a list is easy:
proc print data=have;
where cholesterol = .;
var subject_id;
title 'IDs for subjects who are missing Cholesterol measurement';
run;
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?
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.
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.
Getting a list is easy:
proc print data=have;
where cholesterol = .;
var subject_id;
title 'IDs for subjects who are missing Cholesterol measurement';
run;
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!
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.