The example below shows how to eliminate variables that has only missing values. This code is adapted from SAS-L archives July 2001, week 5.
data temp; input x y z; cards; 1 . 2 2 . 3 4 . 6 ; run;
/***replace 'temp' below with the name of your data set****/ %let have = temp;
/**Do not change anything below**/
*discover min and max for all numeric vars. ; proc means data=&have noprint ; output out=_temp_1; run; *organize as one observation for each numeric var. ; proc transpose data=_temp_1 out=_temp_2 name = _stat_ ; id _stat_; run; /**Create the list of variables to be dropped***/ proc sql noprint; select _stat_ into :dropList separated by ' ' from _temp_2 where min = max and max = . ; quit;
/*Replace 'temp1' with the name of your (new) dataset*/ data temp1 ( drop=&dropList ); set &have; run;
proc print data=temp1; run; Obs x z 1 1 2 2 2 3 3 4 6