Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to reference Macro Variable in PROC SQL

Status
Not open for further replies.

smalek

Programmer
Jan 15, 2009
28
CA
Hi
I have the following scenario. I am importing a number of files and running the same SAS code on them to obtain a workable format. I've elected to use macros in order to make the code more efficient.
Here is basic layout of the code:

%LET BBK=BBK_MAY;
%LET BBK2=BBK_MAY2;
%LET BBK3=BBK_MAY3;

%MACRO import;
PROC IMPORT OUT= &BBK
......................
......................
RUN;
%MEND import;

%MACRO importandformat;
Data &BBK2; set &BBK;
......................
......................
......................
Run;
proc sql;
create table &BBK3 as
select *
from &BBK2;
quit;
%MEND importandformat;
%importandformat;

Every time I run importandformat macro I get an error for the way I am referencing the macro variables in my PROC SQL.

Can someone help me out with the syntax? Any suggestions are much appreciated.

Thanks
 
Silly question(s) maybe.

Have you tried running the code 'stand alone' without using macros to see whether there are errors?

There may be additional code within your SQL step, but as it reads there, why do you need to use SQL for what appears a straightforward subset? Wouldn't a proc sort with an OUT= do pretty much the same thing?

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top