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

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??

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
number_missing = cmiss(of _character_) + nmiss(of _numeric_);
--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26
number_missing = cmiss(of _character_) + nmiss(of _numeric_);
--
Paige Miller
code_blooded
Fluorite | Level 6

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!

Patrick
Opal | Level 21

@code_blooded 

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;

Capture.JPG

How to connect to databases in SAS Viya

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.

Discussion stats
  • 3 replies
  • 1504 views
  • 2 likes
  • 3 in conversation