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

Hello, 

 

I need to aumotatize a process and for this I need to use the date of the system to filter information.

DATA dates;
INPUT name $ 1-4 @6 bday date11.;
CARDS;
John 1 Jan 2019
Mary 11 Jul 2019
Kate 12 Nov 2019
Mark 8 Jun 2019
; RUN;

PROC PRINT DATA=dates;
FORMAT bday date9. ;
RUN;

I catch the date of the system using the function INTNX and I  could use the date like a parameter.

%let day= %sysfunc(intnx( MONTH , %sysfunc( today() ) , 2), date9.);
%put &day;

But, when I will compare, I can't have a good result

DATA dates;
set dates;

where bday > &day;
run;

The mensseges are: 

ERROR: Syntax error while parsing WHERE clause.
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, AND, EQ, GE, GT, LE, LT,
NE, OR, ^=, |, ||, ~=.

ERROR 76-322: Syntax error, statement will be ignored.

1 ACCEPTED SOLUTION

Accepted Solutions
gamotte
Rhodochrosite | Level 12

hello,

 

Is &M1. the same macrovariable as &day. ?

 

Try

where bday >"&M1."d;

 

Do you have to use macros ? can't you just write

where bday > intnx("month", today(),2);

View solution in original post

3 REPLIES 3
gamotte
Rhodochrosite | Level 12

hello,

 

Is &M1. the same macrovariable as &day. ?

 

Try

where bday >"&M1."d;

 

Do you have to use macros ? can't you just write

where bday > intnx("month", today(),2);

emersonaguiar
Calcite | Level 5

Yes, &M1. is the same macrovariable as &day. 

 

I used yours sugestion and work! Tks for support me! Robot Very Happy

andreas_lds
Jade | Level 19

With

options mprint;

active, you would see what the macro pre-processor generated. Most-likely not a sas-date.

 

From what you have posted i can't tell anything more. Posting complete log is recommended.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1080 views
  • 3 likes
  • 3 in conversation