@SyidaRox
Your query_txt needs to be enclosed in a %str() to escape the embedded ',' between your columns
Your RunReport macro, needs to use %unquote(&query) to cater for the character values
/* mock macro for illustration only */
%macro RunReport(isd=, ied=, days=, at=, query=);
%put _user_;
proc sql;
%unquote(&query);
quit;
%mend;
DATA _null_;
/* Sample data */
Start_Dt='06-01-2020';
End_Dt='06-02-2020';
Lookback_Days='1';
Attachment_Type='pdf';
string = cats('%RunReport(ISD='
,STRIP(Start_Dt)
,',IED='
,STRIP(End_Dt)
,',Days='
,STRIP(Lookback_Days)
,', AT='
,STRIP(Attachment_Type)
,', Query=%str('
,'select a.cust_id, a.order_dt, prod_type, prod_subtype from VPS_PRM.order_data a where a.order_dt = %"2020-05-09%")'
,');');
CALL EXECUTE(string);
STOP;
RUN;
Note: I split the CATS () function call across multiple lines for better readability
Hope this helps,
Ahmed
... View more