Hi, I think I have the same question and similar code but it does not seem to be working. PROC SQL; CREATE TABLE WORK.TD_TST AS SELECT t1.id, t1.read_time, (MAX(t1.read_time)) FORMAT=DATETIME22.3 AS MAX_of_read_time, t1.pmax_derated, /* start_date */ (intnx('HOUR',TODAY(),-12) ) LABEL="start_date" AS start_date FROM PBGMES.td_header t1 WHERE t1.id ='1...4' GROUP BY t1.sub_id, t1.pmax_derated, (CALCULATED start_date) /* having t1.read_time = (MAX(t1.read_time))*/ ; QUIT; id read_time max_read_time pmax_derated start_date 130716041724 17JUL2013:13:07:49.000 17JUL2013:13:07:49.000 0 -25200 130716041724 17JUL2013:14:54:01.000 17JUL2013:14:54:01.000 89.420417786 -25200 Thanks, saspert
... View more