DATA Step, Macro, Functions and more

Macro to select multiple files already in a sas library

Reply
Contributor
Posts: 59

Macro to select multiple files already in a sas library

In a sas library named claims I have the following:

claims.inv06_2010_1;
claims.inv06_2010_2;
claims.inv06_2010_3;
claims.inv06_2010_4;
......and so on up to about 100

I would normally have something like
data INV;
set claims.inv06_2010_1;
claims.inv06_2010_2;
claims.inv06_2010_3;
claims.inv06_2010_4;
run;

Is there a way to have a macro identify all of those claims.inv06_2010 tables without having to type out all of the tables individually. I have on average about 100 tables. This example is just for 1 year.
Regular Contributor
Posts: 165

Re: Macro to select multiple files already in a sas library

Posted in reply to omega1983
Try using the sashelp.vcolumn table and proc sql to select the table names into a macro variable.

Good luck!
Contributor
Posts: 59

Re: Macro to select multiple files already in a sas library

thanks
SAS Super FREQ
Posts: 8,868

Re: Macro to select multiple files already in a sas library

Posted in reply to omega1983
You don't actually need a macro program. As long as the names -start- with the same prefix, you can use the colon in a name list, as shown here:
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003040446.htm

See the section entitled, "Data Set Lists" which has an example of how to use the colon to refer to a data set list.

cynthia
Regular Contributor
Posts: 165

Re: Macro to select multiple files already in a sas library

Posted in reply to Cynthia_sas
True, but if you are stuck with SAS 9.1 you don't have that nice little feature.
Contributor
Posts: 59

Re: Macro to select multiple files already in a sas library

Posted in reply to Cynthia_sas
thanks
Ask a Question
Discussion stats
  • 5 replies
  • 159 views
  • 0 likes
  • 3 in conversation