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

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

2 REPLIES 2
Astounding
PROC Star

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.

ArtC
Rhodochrosite | Level 12

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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 3121 views
  • 6 likes
  • 3 in conversation