i need to find a list of variables with all missing values in a dataset.
Can anyone please help me out ?
Ok. There are several ways to do this. But here is one:
Sample 24622: Drop variables from a SAS® data set whose values are all missing
What do you want to do with those variables? Drop them, put them in a data set or something third?
Are the variables of interest all numeric, character or a mix of the two?
Ok. There are several ways to do this. But here is one:
Sample 24622: Drop variables from a SAS® data set whose values are all missing
Sure thing 🙂
data have;
input var1 var2 var3 $ var4 $;
datalines;
1 . A .
. . B .
3 . . .
;
ods output nlevels=nlvs(where=(nnonmisslevels eq 0));
proc freq data=have nlevels;
ods select nlevels;
run;
proc sql noprint;
select tablevar into :drop separated by ' ' from nlvs;
quit;
data want;
set have(drop=&drop);
run;
this is perfect...thanks 🙂
Anytime 🙂
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.