I am attempting to use a PARMBUFF macro in order to repeat a data step with 20 different client definitions (one example below).
DATA _NULL_;
%GLOBAL bank1;
%LET bank1 = O.OWNER LIKE 'XXXXX%';
RUN;
The data step will create separate tables defined by the client macro variables that are created above.
%MACRO CLIENTBUILD/PARMBUFF;
%LET N=%SYSFUNC(COUNTW(&SYSPBUFF,%STR(,)));
%DO I=1 %TO &N;
%LET CLIENT=%SCAN(%QSYSFUNC(COMPRESS(%BQUOTE(&SYSPBUFF),%STR(%(%)))),&I,%STR(,));
CREATE TABLE CLIENT AS
SELECT DISTINCT C.DATE,
C.TIME,
C.RELEASE,
C.TASK
FROM CALLS C
INNER JOIN OWN_GRNT O ON SUBSTR(C.TASK,1,9)= O.TASK
AND &CLIENT
;
%END;
%MEND;
I would like to create this table with the NAME (String) of the macro…but I am having problems referencing the string of the macro for the name of the table. I attempted to reformat the macro as follows (in order to try and call out the string/name of the macro for the name of the table) by using
%MACRO CLIENTBUILD/PARMBUFF;
%LET N=%SYSFUNC(COUNTW(&SYSPBUFF,%STR(,)));
%DO I=1 %TO &N;
%LET CLIENT=%SCAN(%QSYSFUNC(COMPRESS(%BQUOTE(&SYSPBUFF),%STR(%(%)))),&I,%STR(,));
CREATE TABLE '&CLIENT' AS
SELECT DISTINCT C.DATE,
C.TIME,
C.RELEASE,
C.TASK
FROM CALLS C
INNER JOIN OWN_GRNT O ON SUBSTR(C.TASK,1,9)= O.TASK
AND &CLIENT
;
%END;
%MEND;
Then calling the macro out with –
PROC SQL;
%CLIENTBUILD(&NCT);
QUIT;
But this results in the error :
ERROR: The value &CLIENT is not a valid SAS name.`
Is there a solution to call out the macro title that is dependent on the macro variable being used to define the client? Once resolved, I would like to just create every client data set with ....
Proc SQL;
%CLIENTBUILD(&bank1,&bank2,&bank3,..........);
QUIT;