Ashutosh, let me show what SAS can do then we'll discuss what it can't.
The DROP= data set option and DROP statement support variable lists to drop a set of variables. For instance, to drop all the variables from an output data set that begin with the prefix "X" one would code:
[pre]
DATA OUT( DROP=X: );
[/pre]
To drop the variables X1 through X10, one would code:
[pre]
DATA OUT( DROP=X1-X10 );
[/pre]
Variable lists work in many situations where a programmer would like to drop an array of variables.
The situation where variable lists break down is when an array of variables do not have a common prefix. As in:
[pre]
ARRAY A
X Y Z;
[/pre]
In this case using DROP=X--Z may drop X, Y, and Z. I say may because if the variables aren't ordering in the PDV as X, then Y, then Z, the variables you think you're dropping will not be dropped. I'd rather code DROP=X Y Z than use X--Z because maintaining a variable ordering in the PDV can be tricky and obfuscate the code.
If you have a situation where variable lists don't work well, a workaround is to place the array variables in a macro variable. As in this code:
[pre]
%let ArrayVars = x y z;
data out(drop=&ArrayVars.);
array a &ArrayVars.;
set in;
run;
[/pre]
This program will create an array consisting of the variables X, Y, and Z and will drop them from the output data set.
The reason arrays aren't supported with the DROP= or KEEP= option is that the options are not processed by the DATA step. Rather, they are processed by the engine that is used to read or write the data set. The engine is aware of the variables to be read or written, so it can drop or keep them. The engine is not aware of DATA step arrays, so it would not recognize a name as an array. The separation between the DATA step and the engine is what keeps DROP= or KEEP= from handling arrays.
-- Jason Secosky, SAS R&D / DATA Step