Hi everyone,
I have been dealing with this error since yesterday and I cant seem to figure out why. My code shown below:
%macro test(m,d,y);
%let eom_dt=%sysfunc(mdy(&m,&d,&y));
%let eom=%sysfunc(intnx(month,&eom_dt,0,e),yymmddn8.);
%let eom_tera=%sysfunc(intnx(month,&eom_dt,0,e),yymmddd10.);
%let bom_tera=%sysfunc(intnx(month,&eom_dt,0,b),yymmddd10.);
%put &eom &eom_tera &bom_tera;
options SPOOL compress=yes;
proc sql;
create table _9statement_data_&eom as
select mis_dt as MIS_DT2
, crdnbr as CRDNBR2
, CSHLCY as CASH_LIMIT
, stmtmth as STMT_DT
from fc.INT_CRD_M
where crdnbr in (select distinct crdnbr from STMT_1) and
mis_dt = %bquote('&eom_tera')
and stmtmth between %bquote('&bom_tera') and %bquote('&eom_tera')
order by crdnbr
;
quit;
%mend;
%test(1,31,2020);
The error shown was:
22: LINE and COLUMN cannot be determined.
2 The SAS System 09:58 Friday, March 12, 2021
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, AND, EQ, EQT, EXCEPT,
GE, GET, GROUP, GT, GTT, HAVING, INTERSECT, LE, LET, LT, LTT, NE, NET, NOT, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~,
~=.
200: LINE and COLUMN cannot be determined.
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE: Line generated by the macro function "BQUOTE".
54 '2020-01-31'
_
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, (, *, +, -, ALL, ANY, BTRIM, CALCULATED, CASE, INPUT, PUT, SELECT, SOME, SUBSTRING, TRANSLATE,
USER.
ERROR 200-322: The symbol is not recognized and will be ignored.
NOTE 139-205: Line generated by the macro function "BQUOTE".
54 '2020-01-01'
_
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, INPUT, PUT, SUBSTRING, TRANSLATE, USER.
ERROR 200-322: The symbol is not recognized and will be ignored.
22: LINE and COLUMN cannot be determined.
ERROR 22-322: Syntax error, expecting one of the following: !!, *, **, +, -, /, AND, ||.
76: LINE and COLUMN cannot be determined.
ERROR 76-322: Syntax error, statement will be ignored.
any input is very much appreciated. Thanks in advance
Are the comparison variables numeric date variables in the input dataset such as:
mis_dt = %bquote('&eom_tera')
and stmtmth between %bquote('&bom_tera') and %bquote('&eom_tera')
You seem to be comparing them against characters.
Try:
%macro test(m,d,y);
%let eom_dt=%sysfunc(mdy(&m,&d,&y));
%let eom=%sysfunc(intnx(month,&eom_dt,0,e),yymmddn8.);
%let eom_tera=%sysfunc(intnx(month,&eom_dt,0,e),date9.);
%let bom_tera=%sysfunc(intnx(month,&eom_dt,0,b),date9.);
%put &eom &eom_tera &bom_tera;
options SPOOL compress=yes;
proc sql;
create table _9statement_data_&eom as
select mis_dt as MIS_DT2
, crdnbr as CRDNBR2
, CSHLCY as CASH_LIMIT
, stmtmth as STMT_DT
from fc.INT_CRD_SALE_STMT_SNAPSHOT_M
where crdnbr in (select distinct crdnbr from STMT_1) and
mis_dt = "&eom_tera"d
and stmtmth between "&bom_tera"d and "&eom_tera"d
order by crdnbr
;
quit;
%mend;
%test(1,31,2020);
Are the comparison variables numeric date variables in the input dataset such as:
mis_dt = %bquote('&eom_tera')
and stmtmth between %bquote('&bom_tera') and %bquote('&eom_tera')
You seem to be comparing them against characters.
Try:
%macro test(m,d,y);
%let eom_dt=%sysfunc(mdy(&m,&d,&y));
%let eom=%sysfunc(intnx(month,&eom_dt,0,e),yymmddn8.);
%let eom_tera=%sysfunc(intnx(month,&eom_dt,0,e),date9.);
%let bom_tera=%sysfunc(intnx(month,&eom_dt,0,b),date9.);
%put &eom &eom_tera &bom_tera;
options SPOOL compress=yes;
proc sql;
create table _9statement_data_&eom as
select mis_dt as MIS_DT2
, crdnbr as CRDNBR2
, CSHLCY as CASH_LIMIT
, stmtmth as STMT_DT
from fc.INT_CRD_SALE_STMT_SNAPSHOT_M
where crdnbr in (select distinct crdnbr from STMT_1) and
mis_dt = "&eom_tera"d
and stmtmth between "&bom_tera"d and "&eom_tera"d
order by crdnbr
;
quit;
%mend;
%test(1,31,2020);
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.