Hello everyone, I’m encountering an unexpected rounding behavior when applying the TIME12.3 format to numeric values that share the same decimal part. For example, consider the values 99.3765 and 67.3765. After applying TIME12.3, I obtain different results: 99.3765 → 0:01:39.377 67.3765 → 0:01:07.376 This suggests that 99.3765 is being rounded up to .377, while 67.3765 is not. Suspecting a floating-point representation issue, I examined their binary64 representations and converted them back to decimal. The results are: For 99.3765 TIME12.3 result: 0:01:39.377 Binary64: 0100000001011000110110000001100010010011011101001011110001101010 Converted back: 99.37649999999999295142 For 67.3765 TIME12.3 result: 0:01:07.376 Binary64: 0100000001010000110110000001100010010011011101001011110001101010 Converted back: 67.37649999999999295142 Both values are stored slightly below 0.3765, so based purely on their numeric representations, neither appears to meet the usual rounding threshold for .377. However, SAS rounds up 99.3765 but not 67.3765. Does anyone know why TIME12.3 would produce different rounding behavior for these two values? Could this be related to how SAS internally decomposes time values (for example, hours, minutes, seconds) or applies rounding during formatting? For reference, here is the code I used: data num; input value; datalines; 99.3765 67.3765 ; run; data time; set num; time = put(value, time12.3); b64 = put(value, binary64.); run; Any insight into SAS’s internal rounding logic for time formats would be greatly appreciated.
... View more