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;

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2379 views
  • 6 likes
  • 3 in conversation