Hi All,
I am facing problem in resolving date variable for given calculation; please find code below. But it is giving me error. Any help is really appreciated....
PROC SQL NOPRINT;
SELECT * FROM FACT WHERE
FACT.INCEP_DT BETWEEN (&NEXT_REP_PERIOD_START
AND &NEXT_REP_PERIOD_END);
QUIT;
PROC SQL;
SELECT MIN(STRT_DT) FORMAT=DATETIME20. INTO :NEXT_REP_PERIOD_START
FROM PRD
WHERE YEARR = 2012;
SELECT MIN(END_DT) FORMAT=DATETIME20. INTO :NEXT_REP_PERIOD_END
FROM PRD
WHERE YEARR = 2012;
QUIT;
Oh. That is not SAS datetime constant. you should use some syntax like '01jan2012:00:00:00'dt to pass it.
FACT.INCEP_DT BETWEEN ( "&NEXT_REP_PERIOD_START"dt
AND "&NEXT_REP_PERIOD_END"dt );
what is your ERROR Log ?
Hi Ksharp
Following is my error log
PROC SQL NOPRINT;
16 SELECT * FROM FACT WHERE
17 FACT.INCEP_DT BETWEEN (&NEXT_REP_PERIOD_START
18 AND &NEXT_REP_PERIOD_END);
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
NOTE: Line generated by the macro variable "NEXT_REP_PERIOD_START".
18 01JAN2012:00:00:00
_______
22
76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN,
CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.
ERROR 76-322: Syntax error, statement will be ignored.
Oh. That is not SAS datetime constant. you should use some syntax like '01jan2012:00:00:00'dt to pass it.
FACT.INCEP_DT BETWEEN ( "&NEXT_REP_PERIOD_START"dt
AND "&NEXT_REP_PERIOD_END"dt );
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.