BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Barney1998
Obsidian | Level 7

Dear all,

I have one big data set and i wanna to know which variables have at least one missing value .I know the two common ways (proc freq ,and where vr is missing).Ι wonder about if exist one order to print me all the variables names from my data set which have at least one missing value.

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @Barney1998,

 

You can use the NLEVELS option of the PROC FREQ statement:

ods select none;
ods output nlevels=want(where=(nmisslevels));
proc freq data=have nlevels;
tables _all_;
run;
ods select all;

proc print data=want;
var tablevar;
run;

If your dataset is really big (e.g. >10 GB), you may want to temporarily restrict the number of observations (or variables) by means of dataset options such as OBS= (or KEEP=), e.g., have(obs=1000000), and see how the run time develops when you increase the limit.

 

 

View solution in original post

4 REPLIES 4
FreelanceReinh
Jade | Level 19

Hello @Barney1998,

 

You can use the NLEVELS option of the PROC FREQ statement:

ods select none;
ods output nlevels=want(where=(nmisslevels));
proc freq data=have nlevels;
tables _all_;
run;
ods select all;

proc print data=want;
var tablevar;
run;

If your dataset is really big (e.g. >10 GB), you may want to temporarily restrict the number of observations (or variables) by means of dataset options such as OBS= (or KEEP=), e.g., have(obs=1000000), and see how the run time develops when you increase the limit.

 

 

Barney1998
Obsidian | Level 7

with the nlevels from proc sql i have that type of problem. Existed  columns which was empty but (i don't know why) the nmissing value from the output was equal to 0.

Thank you for your advice!

Barney1998
Obsidian | Level 7
thanks so much for your solution! It's absolutely fine!
Have a nice day @FreelanceReinhard !
thanks a million!
Ksharp
Super User
data have;
 set sashelp.heart;
run;



proc transpose data=have(obs=0) out=vname;
var _all_;
run;
proc sql noprint;
select cat('nmiss(',_name_,') as ',_name_) into :nmiss separated by ','
 from vname;

create table temp as
select &nmiss. from have;
quit;
proc transpose data=temp out=want(where=(col1>0));
var _all_;
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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 642 views
  • 1 like
  • 3 in conversation