i can show you the problem im facing This is the code im running, i have created a macro SCE_OOR_REV_BILLING_FINANCE and it has PROC SQL statement with the macro Argument &CHARGE as a column name as well as text field. I used BQUOTE to add quotes to the macro variable but i am getting the following error. %macro SCE_OOR_REV_BILLING_FINANCE(CHARGE=);
proc sql;
create table SCE_OOR_REV_BILLING_FINANCE as
select CONTRACT,
%bquote('&CHARGE') as CHARGE_DESC,
sum(CHARGE.) as CHARGE
from (
select
contract,
0 as LATE_PaAYMENT_CHARGE_COMM,
0 as LATE_PaAYMENT_CHARGE_RESIDENTIAL,
0 as RETURNED_CHECK_CHARGES,
0 as SERVICE_CONNECTION_CHARGES_RES,
0 as SERVICE_CONN_CHARGES_NON_RES,
0 as SERVICE_CONN_CHARGES_AT_POLE,
0 as OPTOUT_RESCARE_INIT_FEE,
0 as OPTOUT_FERA_NON_CARE_IFEE,
0 as RECOVER_UNAUTH_USE_ENERGY,
0 as SERVICE_FEE_OPTIMAL_BILL,
0 as AR_SERVICE_GUARANTEE,
0 as CCA_INFORMATION_FEES,
0 as DA_REVENUE,
0 as DMS_SERVICE_FEE,
OPT_OUT_RESCARE_MONTHLY,
OPT_OUT_FERA_NONCARE_MONTHLY,
ELECTRIC_SURCHARGE,
SCE_ENERGY_MANAGER_FEE,
CUST_FIN_ADDED_FAC_FERC,
CUST_FIN_ADDED_FAC_CPUC,
SCE_FIN_ADDED_FAC_FERC,
SCE_FIN_ADDED_FAC_CPUC,
CUST_FIN_IC_ADD_FAC_FERC,
CUST_FIN_IC_ADD_FAC_CPUC,
SCE_FIN_IC_ADD_FAC_FERC ,
SCE_FIN_IC_ADD_FAC_CPUC
from SCE_OOR_REV_BILLING
union all
select
contract,
LATE_PaAYMENT_CHARGE_COMM,
LATE_PaAYMENT_CHARGE_RESIDENTIAL,
RETURNED_CHECK_CHARGES,
SERVICE_CONNECTION_CHARGES_RES,
SERVICE_CONN_CHARGES_NON_RES,
SERVICE_CONN_CHARGES_AT_POLE,
OPTOUT_RESCARE_INIT_FEE ,
OPTOUT_FERA_NON_CARE_IFEE,
RECOVER_UNAUTH_USE_ENERGY,
SERVICE_FEE_OPTIMAL_BILL,
AR_SERVICE_GUARANTEE,
CCA_INFORMATION_FEES,
DA_REVENUE,
DMS_SERVICE_FEE,
0 as OPT_OUT_RESCARE_MONTHLY,
0 as OPT_OUT_FERA_NONCARE_MONTHLY,
0 as ELECTRIC_SURCHARGE,
0 as SCE_ENERGY_MANAGER_FEE,
0 as CUST_FIN_ADDED_FAC_FERC,
0 as CUST_FIN_ADDED_FAC_CPUC,
0 as SCE_FIN_ADDED_FAC_FERC,
0 as SCE_FIN_ADDED_FAC_CPUC,
0 as CUST_FIN_IC_ADD_FAC_FERC,
0 as CUST_FIN_IC_ADD_FAC_CPUC,
0 as SCE_FIN_IC_ADD_FAC_FERC,
0 as SCE_FIN_IC_ADD_FAC_CPUC
FROM SCE_OOR_REV
)
group by CONTRCAT
;
run;
%mend SCE_OOR_REV_BILLING_FINANCE;
%SCE_OOR_REV_BILLING_FINANCE(CHARGE=LATE_PaAYMENT_CHARGE_COMM); 99 %SCE_OOR_REV_BILLING_FINANCE(CHARGE=LATE_PaAYMENT_CHARGE_COMM);
NOTE: Line generated by the invoked macro "SCE_OOR_REV_BILLING_FINANCE".
99 create table SCE_OOR_REV_BILLING_FINANCE as select CONTRACT, %bquote('&CHARGE') as CHARGE_DESC,
99 ! sum(CHARGE.) as CHARGE from ( select contract, 0 as LATE_PaAYMENT_CHARGE_COMM,
_
22
99 ! 0 as
ERROR 22-322: Syntax error, expecting one of the following: a name, *.
NOTE: Line generated by the macro function "BQUOTE".
99 'LATE_PaAYMENT_CHARGE_COMM'
_
22
_
200
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, CALCULATED, CASE, EXISTS, INPUT, NOT, PUT, SUBSTRING, TRANSLATE, USER, ^, ~.
3 The SAS System Thursday, November 5, 2020 06:05:00 PM
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect. What makes it confusing is this NOTE: Line generated by the macro function "BQUOTE". 99 'LATE_PaAYMENT_CHARGE_COMM' So it is resolving properly but somehow PROC SQL is failing.
... View more