I need to call a macro code from proc sql in SAS like below.
PROC SQL;
CONNECT TO DB2 (SSID = &DGSYS);
CREATE TABLE <DS_NAME> AS
SELECT * FROM CONNECTION TO DB2
(
SELECT * FROM <TAB_NAME> WHERE...
);
%MACRO_CODE(....) --> am calling a macro block of code here
DISCONNECT FROM DB2;
QUIT;
But this is throwing up an error. Could this not be done?
When I used a macro variable in my query it is allowing me but not a call made to macro code.
The macro would create another macro variable which will be an IN CLAUSE holding values from the previously created table/dataset. And it would be subsequently used in the another CREATE TABLE... in side the same PROC SQL.
proc sql
statement, the macro will likely fail. – thelatemail