DATA Step, Macro, Functions and more

How to create ">" in a macro?

Accepted Solution Solved
Reply
Contributor
Posts: 52
Accepted Solution

How to create ">" in a macro?

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?


Accepted Solutions
Solution
‎05-22-2012 06:09 PM
Occasional Contributor
Posts: 9

Re: How to create ">" in a macro?

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


All Replies
Contributor
Posts: 44

Re: How to create ">" in a macro?

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

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

Regular Contributor
Posts: 241

Re: How to create ">" in a macro?

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
  --*;

Solution
‎05-22-2012 06:09 PM
Occasional Contributor
Posts: 9

Re: How to create ">" in a macro?

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.)

Contributor
Posts: 52

Re: How to create ">" in a macro?

Ok thx, it works!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 263 views
  • 4 likes
  • 4 in conversation