BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nanmz
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
qoit
Pyrite | Level 9

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);

View solution in original post

2 REPLIES 2
qoit
Pyrite | Level 9

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);
nanmz
Fluorite | Level 6

Hi @qoit 

 

Thanks for your input. I tried your approach and it worked!!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 4696 views
  • 3 likes
  • 2 in conversation