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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.