Hi all,
I have a written a code where the tx_date is in DATETIME22.3 (21NOV2006:00:00:00.000) format and I have set Start_trace and End Trace in libraries which is in DATE9. (15MAR2022) format. In my code, I am getting error the date format is not equal. So I used the Datepart function but still shows the same error. Can you please suggest how to convert the date in the same pattern?
proc sql;
create table Trace_Stamped as
select distinct debt_code,
DATEPART(tx_date) format date9. as tx_date
from p2scflow.debt_trans
where tran_code in ('MO9741','MO9742','MO9743','MO9744','MO9745','MO9746','MO9747','MO9748')
and tx_date >= &Start_trace and
tx_date <= &End_Trace ;
run;
Error log:
30 proc sql;
31 create table Trace_Stamped as
32 select distinct debt_code,
33
34 DATEPART(tx_date) format date9. as tx_date
35
36 from p2scflow.debt_trans
37 where tran_code in ('MO9741','MO9742','MO9743','MO9744','MO9745','MO9746','MO9747','MO9748')
38 and tx_date >= &Start_trace and
39 tx_date <= &End_Trace
40
41 ;
ERROR: Expression using greater than or equal (>=) has components that are of different data types.
NOTE: The IN referred to may have been transformed from an OR to an IN at some point during PROC SQL WHERE clause optimization.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
42 run;
... View more