Sunday, May 13, 2012

SAS Wildcard for Variable List

For posterity, the wildcard character for variable list in SAS is “:”. An example:

data auctionDateData;

  set temp;

  keep Announce_Date Auction_Date Issue_date termType;

  keep auction_dateYield:;

run;

The page I referenced below talks about other specifications also - specifying only numeric variables, only character variables, and the standard selection by numbering (i.e., var1-var25 var32-var50).

Knowing this would change how I named my variables (i.e., using more “_” to categorize my variables so I can use “:” and “_” to distinguish the groups I want to isolate.)

Reference: SAS Variables SAS Variable Lists [support.sas.com]