I am using select into to store the most recent datetime record from my table as such: select max(MODSTAMP) into :max_ts from my_table; %put max_ts: &maxt_s; This produces a value like 29JUN2017:23:59:52.000000. The MODSTAMP in my Teradata table is stored as a TIMESTAMP(6). I do this twice: once to get the current max_ts, then I insert some records, and then again to get the new_maxts. My problem is this: when I compare max_ts to new_maxts, the values are stored and evaluated as strings: %IF &new_maxts > &max_ts %THEN %DO; %goto start; %END; When it rolls into a new month, the evaluation produces a fales result: SYMBOLGEN: Macro variable NEW_MAXTS resolves to 04MAR2017:00:39:08.000000 SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. SYMBOLGEN: Macro variable MAX_TS resolves to 28FEB2017:17:23:56.000000 SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing. MLOGIC(MYLOOP): %IF condition &new_maxts > &max_ts is FALSE The IF condition should be TRUE, but this happens because zero comes before two in sting fields. I have tried tons of different formatting, including adding tickies and "dt" like '04MAR2017:00:39:08.000000'dt. and the result was the same. Any suggestions would be greatly appreciated!
... View more