hello! i have a question, this macro code 'casecomis(nr)' can work in proc sql select ? in this moment i how error . %let edd = %sysfunc(putn("&data_fin"d, ddmmyy6.)); %put &edd; /*from prompt*/ %let beg = %sysfunc(putn("&data_ini"d, ddmmyy6.)); %put &beg; /*from prompt*/ %let nr = &nrluni; /*from prompt*/ %put &nr; %let S1 = %sysfunc(intnx(month,"&data_fin"d,-0,end),yymmn4.); %put &S1; %let S2 = %sysfunc(intnx(month,"&data_fin"d,-1,end),yymmn4.); %put &S2; %let S3 = %sysfunc(intnx(month,"&data_fin"d,-2,end),yymmn4.); %put &S3; %macro casecomis(nr); %do j=0 %to &nr; %let i=%eval(&j+1); %let luna= &S&i; %let separatorb =%str(,); %let varbeg= %sysfunc(intnx(month,"&data_fin"d,-&j,BEGINNING)); %let varend= %sysfunc(intnx(month,"&data_fin"d,-&j,end)); %let varcase= %sysfunc(case when (data_pos >=&varbeg and data_pos<=&varend) then SF else 0 end as INC_&luna); %put &varcase; %put &separatorb; %end; %let aa= INC_&S1; %do i=2 %to &nr; %let total=%eval(&aa+((INC_&&S&j)); %put &total; %end; %mend casecomis; proc sql; Create table ComSS as select * , %casecomis(&nr) as INC_Total from ExemplComss; Log error: 301 proc sql; 302 Create table ComisioaneSF as select * , %casecomis(&nr) as INC_Total WARNING: Apparent symbolic reference S not resolved. ERROR: Expected open parenthesis after macro function name not found. 4 The SAS System 10:17 Friday, June 26, 2020 (data_pos >=22036 and data_pos<=22066) then SF else 0 end as INC_2005) , WARNING: Apparent symbolic reference S not resolved. ERROR: Expected open parenthesis after macro function name not found. (data_pos >=22006 and data_pos<=22035) then SF else 0 end as INC_2004) , 302 Create table ComSS as select * , %casecomis(&nr) as INC_Total _________ 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, '.', /, <, <=, <>, =, >, >=, ?, AND, AS, CONTAINS, EQ, EQT, GE, GET, GT, GTT, LE, LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=. 303 from ExemplComss; NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. Thanks!!!
... View more