I have a macro variable:
%let xcesint = '20121131'; (gives no issues)
%let xcesint = %str(%')%sysfunc(intnx(year,&mydate,-1,end),yymmddn8.)%str(%'); (gives issues as below)
*******************************************LOG*************************************************************************************
2744 +data xcsint2&tapein&version;
SYMBOLGEN: Macro variable TAPEIN resolves to OlsBeliz
SYMBOLGEN: Macro variable VERSION resolves to
2745 + set xcsint&tapein&version;
2746 + xcsint = amtinfrc;
2747 + xcsintdt = &xcesint;
SYMBOLGEN: Macro variable XCESINT resolves to '20111231'
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
_
_
_
386
386
386
________
________
________
200
200
200
ERROR 386-185: Expecting an arithmetic expression.
ERROR 386-185: Expecting an arithmetic expression.
ERROR 386-185: Expecting an arithmetic expression.
66 The SAS System 16:28 Thursday, March 14, 2013
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 200-322: The symbol is not recognized and will be ignored.
***********************************************************************************************************************************************************
Though both the variables are resolving to same value why is my second attempt failing?
Here's the likely missing link:
%let xcesint = %unquote(the exact same value being assigned now);
SAS's message indicates that it hasn't figured out soon enough that it should be unquoting the special characters in your assigned value. So just apply %unquote yourself.
As a side note, I would guess it's safer to remove the dot at the end of the format when using %sysfunc: yymmddn8
Good luck.
Here's the likely missing link:
%let xcesint = %unquote(the exact same value being assigned now);
SAS's message indicates that it hasn't figured out soon enough that it should be unquoting the special characters in your assigned value. So just apply %unquote yourself.
As a side note, I would guess it's safer to remove the dot at the end of the format when using %sysfunc: yymmddn8
Good luck.
It has been my experience that storing quotes with a macro variable is very very rarely either necessary or a good idea. You can always add them when needed at resolution time.
We cannot see what your &MYDATE contains, but the code indicates that it is a SAS date value and not a date form as is &XCESINT.
%let mydate = 18945;
%let mydate2 = %sysfunc(putn(&mydate,yymmddn8 ));
%let xcesint = %sysfunc(intnx(year,&mydate,-1,end),yymmddn8.);
%put &mydate2 &xcesint;
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.