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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.