Hi!
I am looking to determine the number of missing values for each observation (rows) in my dataset which has both numeric and character variables. it is a fairly large dataset >500 variables and has a mix of both character and numeric variables. I tried using cmiss but it said that the variables had to be either all character or all numeric.
Any insights??
number_missing = cmiss(of _character_) + nmiss(of _numeric_);
number_missing = cmiss(of _character_) + nmiss(of _numeric_);
Thanks Paige. This worked however I am getting one extra count for the missing values. ANy idea what might have cause this?
Below is the code that I have been using:
data miss;
set test;
nmiss = cmiss(of _character_) + nmiss(of _numeric_);
run;
Thanks for the help!
It works for me. Before investigating your code may be execute below and verify that this also works in your environment and for your SAS version.
data test;
length ca cb $1 na nb 8;
call missing(of _all_);
na=1;
n_missing=cmiss(ca,cb,na,nb);
output;
stop;
run;
proc print;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.