Site hosted by Build your free website today!
SAS(r) Software Tips
How to drop all variables beginning with a given prefix 
The situation arises often. You have a number of variables that all start with the same prefix and you wish to drop or keep them.

A good example is PROC TRANSPOSE output. Often you may use the PREFIX option for convenience, then carry out some processing in a datastep. Frequently the variables output from TRANSPOSE are then of no interest.

To do this, use the drop or keep statement as follows::

drop _: ; 
keep _: ; 

The : is a wildcard that causes any variable name starting with the prefix (in this case underscore) to be dropped or kept.

Contact Don Stanley