I am trying to write a query that will select MIN and MAX timestamp on a single day. I am able to get a vast majority of my data to pull, but there are issues on a few of the rows where I can pull the MIN date but when I change it to MAX I get a page break as the results. There are multiple timestamps per day, but if not it still should select the same timestamp for MIN and MAX.     My code is extremely long or I would post it.     I am using a having statement to select the min and max similar to this:        proc sql;
SELECT distinct t2.no,
					T1._ID,
					t2.id, 
					t3.First_Name
					t3.last_name
					t3.TITLE, 
					t3.02_LOCATION
					t3.Level_01, 
					t3.Level_02, 
					T1.M_TS
					T1.O_TS
					t3.employee
					T1.O_A
				FROM TEST.DAY T2
					INNER JOIN B.LE T1 ON (T2.ID = T1._ID and (PUT(DATEPART(T2.ADate),date9.) = PUT(DATEPART(T1.M_TS),date9.)))
					INNER JOIN B.E T3 ON (T1.O_A = T3.EMPLOYEE AND (t3.O_TS > '15Dec9999:0:0:0'dt))
					WHERE T2.NO = '11111-11111'
						GROUP BY T1._ID
							HAVING M_TS = MAX(T1.M_TS) and 
								O_TS = MIN(T1.O_TS) AND
								FIRST_NAME = scan(t3.first_name,1,' ') AND 
								LAST_NAME = SCAN(T3.LAST_NAME,1,' ')
;
run;        I change nothing in the code but the MAX to MIN and the code works. Does anyone have an idea of what could cause this issue? 
						
					
					... View more