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

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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.

View solution in original post

1 REPLY 1
Astounding
PROC Star

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.

CFC_SAS_Communities_400x225.jpgCFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 1 reply
  • 1254 views
  • 1 like
  • 2 in conversation