I’m trying to accomplished this task using SAS.
I have a table PRODUCTS with columns product, date_start, query.
Column query has a string with that is a query I want to run through macro and call execute.
For now, I have only one query, following:
CREATE TABLE RESULT AS
SELECT T1.COL1, T1.COL2, T1.COL3, SUM(T2.VALUE) AS VALUE
FROM TABLE1 T1 INNER JOIN TABLE2 T2
ON T1.COL1 = T2.COL1 AND T1.COL2 = T2.COL2
WHERE T2.COL5 = 'A'
;
And then a I run the following code:
%MACRO RUN_QUERY(PARAM1);
PROC SQL;
&PARAM1
;QUIT;
%MEND RUN_QUERY;
DATA _NULL_;
SET PRODUCTS;
CALL EXECUTE('%RUN_QUERY(PARAM1='||QUERY||');');
RUN;
And I got an error:
ERROR: All positional parameters must precede keyword parameters.
What’s going on? And how to solve it?
I suspect it is related to dots used in the query string.
1