I have the following code. I am doing a remote submit and uploading macro variables to remote server. The macro variables are sometimes getting resolved and sometimes don't. Can you please help me optimize the code to make it behave more consistently ? %macro rtlmn1; %do i=1 %to 2; %let datep = %sysfunc(intnx(month,&dater.,-1*&i,b)); data _null_; set sashelp.class(obs=1); prvmnt&i. = put(&datep.,monyy7.); put prvmnt&i.; call symput("prvmnt&i.",prvmnt&i.); prev_mon&i. = year(&datep.)*100 + month(&datep.); put prev_mon&i.; call symput("prmn&i",prev_mon&i.); run; %let prmn&i. = &&prmn&i.; /*to remove spaces from values*/ %end; %mend rtlmn1; %rtlmn1 %syslput _user_/ remote = remhost; %macro rtlmn2; %do i = 1 %to 2; %syslput i=&i. /remote=remhost; rsubmit; proc sql; create table %nrstr(report_3_part&i.) as ( select location_id as LocationId , Merchant_family as MerchantFamily ,store_id as StoreId,store_desc as StoreDesc ,zip_code as ZipCode,DMA_name as DmaName ,store_state_nm as StoreState, sum( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id = 111 then 1 else 0 end) as cn1_%nrstr(&&prvmnt&i.) , sum ( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id =111 then transaction_amt else 0 end) as cnt2_%nrstr(&&prvmnt&i.), sum( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id = 222 and reload = 1 then 1 else 0 end) as cnt3_%nrstr(&&prvmnt&i.), sum ( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id = 222 and reload = 1 then transaction_amt else 0 end) as cnt4_%nrstr(&&prvmnt&i.), sum ( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id = 333 and vanilla = 1 then 1 else 0 end) as cnt5_%nrstr(&&prvmnt&i.), sum ( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id = 333 and vanilla = 1 then transaction_amt else 0 end) as cnt6_%nrstr(&&prvmnt&i.), sum ( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id = 444 and green = 1 then 1 else 0 end) as cnt8_%nrstr(&&prvmnt&i.), sum ( case when sales_month = %nrstr(&&prmn&i.) and transaction_type_id =444 and green = 1 then transaction_amt else 0 end) as cnt9_%nrstr(&&prvmnt&i.) from final_trans_Set group by Merchant_family , store_id,store_desc,zip_code,DMA_name,location_id,store_state_nm ); quit ; endrsubmit; %end; %mend rtlmn2; %syslput _user_/ remote = remhost; %rtlmn2 NOTE: Line generated by the macro variable "I". 2 &prmn1 - 22 WARNING: Apparent symbolic reference PRMN1 not resolved. ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.
... View more