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

I want to calculate the number of missing values in my dataset for each column and output the results to a separate dataset so I can later drop the variables that have more than X% missing values. The code below is the one that is used:

 

Data have(drop=x);
Do x = 1 to 5;
	very_long_variable_name_12m = x;
	very_long_variable_name_24m = x*2;
	If x > 3 then call missing (very_long_variable_name_12m,very_long_variable_name_24m);
	Output;
End;
Run;

Proc means data=have nmiss;
Output out=not_want nmiss= /autoname;
Run;

When proc means outputs the variable it cuts off a significant part of the variable name making it impossible to understand what variable is being referenced.

My original dataset has thousands of variables, so fixing this issue by hand is not an option. Can someone please help?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Don't use /autoname. In this simplified case where there is only one output statistic, why would you need to have _NMISS at the end?

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

Don't use /autoname. In this simplified case where there is only one output statistic, why would you need to have _NMISS at the end?

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1106 views
  • 0 likes
  • 2 in conversation