- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have created two date Macros to take out a subset of a huge dataset. Below is the code
data Start rest ;
set Start3;
if start_date2 GE &fildt1. and start_date2 LE &fildt2. then output start;
else output rest;
run;
The date macros are producing proper dates but the If condition is throwing error
The error I am getting is
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>,
=, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |,
||, ~=.
ERROR 388-185: Expecting an arithmetic operator.
ERROR 76-322: Syntax error, statement will be ignored.
What am I doing wrong here?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you try the change below
data Start rest ;
set Start3;
if start_date2 GE "&fildt1."d and start_date2 LE "&fildt2."d then output start;
else output rest;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you show the community what the date macros are resolving to and data type of your start_dates
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SYMBOLGEN: Macro variable FILDT1 resolves to 27SEP2018
NOTE: Line generated by the macro variable "FILDT1".
335 27SEP2018
-------
22
SYMBOLGEN: Macro variable FILDT2 resolves to 03OCT2018
NOTE: Line generated by the macro variable "FILDT2".
335 03OCT2018
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you try the change below
data Start rest ;
set Start3;
if start_date2 GE "&fildt1."d and start_date2 LE "&fildt2."d then output start;
else output rest;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content