Hi all,
I've been messing around with Macro's and it looks like I'm getting the "expected" output but it's throwing an error.
My expected result is 01NOV2019; which I will then use in reference later with
where date = "&Test"d
Below is what I have thus far, the log is stating the correct output but it's also complaining about an error and my dataset is incomplete.
%let day=%sysfunc(Today(), date9.);
%let Test=%sysfunc(intnx(month,"&day"d,0),date9.);
DATA TEST;
Column = &Test;
RUN;
281884 %let day=%sysfunc(Today(), date9.);
281885 %let Test=%sysfunc(intnx(month,"&day"d,0),date9.);
281886 DATA TEST;
281887 Column = &Test;
NOTE: Line generated by the macro variable "TEST".
1 01NOV2019
-------
22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.
281888 RUN;
Your DATA step contains this invalid statement:
Column = 01NOV2019;
It's invalid if you were to code it yourself, and just as invalid if macro language generates it.
Your DATA step contains this invalid statement:
Column = 01NOV2019;
It's invalid if you were to code it yourself, and just as invalid if macro language generates it.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.