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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: