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

I am using

%SYSFUNC(cats(&number,_,'>',%SYSFUNC(Intnx(year, &dvar, -1, end), DDMMYYP10.)))

in a Macro to create the text

14_>31.12.2018

However, I get the error:

-----------------------------

NOTE: Line generated by the macro function "SYSFUNC".

23          14_'>'31.12.2018

               ___

               49

----------------------------

How can I eliminate the error?

1 ACCEPTED SOLUTION

Accepted Solutions
dbiehle
Calcite | Level 5

Agree with chang_y_chung: just try without CATS.

Your code:

%SYSFUNC(cats(&number,_,'>',%SYSFUNC(Intnx(year, &dvar, -1, end), DDMMYYP10.)))


Edited code:

&number_>%SYSFUNC(Intnx(year, &dvar, -1, end), DDMMYYP10.)

View solution in original post

4 REPLIES 4
JasonDiVirgilio
Quartz | Level 8

Try %str(>) instead of single quotes in a macro.

%SYSFUNC(cats(&number,_,%str(>),%SYSFUNC(Intnx(year, &dvar, -1, end), DDMMYYP10.)));

chang_y_chung_hotmail_com
Obsidian | Level 7

Hope this helps a bit. Good luck!

  %*-- cats() called through %sysfunc() seems to evaluate > as a logical expression
       even when macro quoted. ran on 9.3 ts1m0 on w32_7pro --*;
  %put %sysfunc(cats(***,%str(>),***));
  %*-- on log -- 0 since null(nothing) is not greater than another null.
  ***0***
  --*;
 
  %*-- but we do not need cats for string concatenation in macro --*;
  %let number = 14;
  %let date = %sysfunc(today());
 
  %let ldopy = %sysfunc(intnx(year, &date, -1, end), DDMMYYP10.);
  %put last day of previous year = &ldopy;
 
  %put &number._>&ldopy;
  %*-- on log
  14_>31.12.2011
  --*;

dbiehle
Calcite | Level 5

Agree with chang_y_chung: just try without CATS.

Your code:

%SYSFUNC(cats(&number,_,'>',%SYSFUNC(Intnx(year, &dvar, -1, end), DDMMYYP10.)))


Edited code:

&number_>%SYSFUNC(Intnx(year, &dvar, -1, end), DDMMYYP10.)

sfmeier
Obsidian | Level 7

Ok thx, it works!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 1398 views
  • 4 likes
  • 4 in conversation