Desktop productivity for business analysts and programmers

Date macro using Between operator

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 81
Accepted Solution

Date macro using Between operator

This is used to run fine in Base SAS Mainfram (I got rid of the "D after the &DATE1) but it's not running in SAS EG.  It says in the error that I;m missing punctuation? Where?

 

 

87 /*- CREATE FILE WITH PCM INDICATOR TO BE ADDED TO PROVIDER FILE -*;*/

188 /*- CONSIDER PCM IF ROLE 01 OR 02 AS OF END OF REPORTING PERIOD -*;*/

189

190 DATA PROVPCM;

191 SET &NAME..PROV;

192 IF RENDROLE IN ('2' '3') AND

193 ROLEEND >=&DATE1 AND ROLEBEG <= &DATE1;

NOTE: Line generated by the macro variable "DATE1".

193 31JAN2018

_______

22

NOTE: Line generated by the macro variable "DATE1".

193 31JAN2018

_______

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, ^=, |, ||, ~=.


Accepted Solutions
Solution
‎02-17-2018 05:54 PM
PROC Star
Posts: 1,357

Re: Date macro using Between operator

[ Edited ]

wrap in double quotes

ROLEEND >="&DATE1"d AND ROLEBEG <= "&DATE1"d

View solution in original post


All Replies
Solution
‎02-17-2018 05:54 PM
PROC Star
Posts: 1,357

Re: Date macro using Between operator

[ Edited ]

wrap in double quotes

ROLEEND >="&DATE1"d AND ROLEBEG <= "&DATE1"d
☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 181 views
  • 0 likes
  • 2 in conversation