You have a couple of problems with your macro. Like @Reeza mentioned, you'd have to use the minoperator option to us the in operator in a macro. Plus, you would have to change the way you use the operator.
Plus you have an extra comma in your proc sql code:
MAX(DIAS_ATRASO) AS DIAS_ATRASO_&TABELA.,
And what are you trying to accomplish with the sum function?
Finally, you declare a fifth parameter in your macro, but only include four values when you call the macro.
Here is the code I ran:
data tabela;
input cpfcnpj dias_atraso;
cards;
1 1
1 2
1 3
1 4
2 2
2 4
2 6
2 8
;
run;
options minoperator;
%MACRO EXPOSICOES(TABELA,VL_PMT,EXPOSICAO,VAR_PROVISAO,CONDICAO);
PROC SQL;
CREATE TABLE SALDO_&TABELA. AS
SELECT CPFCNPJ,
%IF NOT (&TABELA IN OUTROS AGRO CHEQUE) %THEN %DO;
SUM(&VL_PMT.) AS PMT_&TABELA.,
%END;
MAX(DIAS_ATRASO) AS DIAS_ATRASO_&TABELA. /*,*/
FROM TABELA WHERE CPFCNPJ > 0
GROUP BY CPFCNPJ
;
QUIT;
%MEND EXPOSICOES;
%EXPOSICOES(OUTROS,.,TABELA,VAR_PROVISAO)
Art, CEO, AnalystFinder.com
... View more