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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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