02-06-2014 01:41 PM
Hi all you clever people:
I have created a program that reads selected members from a SAS table using a prefix, such as:
SET infile.af: ;
which reads all members in "infile" that begin with "AF".
This works fine on our development server - which is running 9.3, but will not run on our production
system, which is running 9.1 - seems this change was made in SAS in 9.2.
I know that there is a way to read the dictionary tables, read the members in the library from there and then
build a list to read, but I would like to do this with a macro so I can select the "prefix" for each set of members
to select and re-use it for different selections in the same program.
Any help would be appreciated.
02-06-2014 02:29 PM
proc copy select statement has supported this : handling since before sas v6
Alternatively populate the ds list with code like :
%let parm = sashelp.v: ;
proc sql noprint ;
select catx('.', libname, memname )
Into :mem_list separated by ' '
Where libname = "%upcase(%scan( work.&parm,-2,.))"
And memname eqT "%upcase(%scan(&parm,-1,:.))"
%put found &sqlobs things beginning &parm. The list is &mem_list ;
The EQT operator is similar to datastep =: operator.
Look up the online doc for proc sql to see that EQT does what you want.
Message was edited by: Peter Crawford .. .. .. really, proc copy is not enough