01-16-2017 10:20 PM
In my data the following values present for a time variable.
When I used put function to convert to character, I am getting different values eventhough the time values are same. Any suggestions. Please help. Thanks
ID Time time1
1 00:00:00 0:00:00
1 00:00:00 24:00:00
01-16-2017 11:28 PM
Are there no other components to the date, such as a decimal or a day value?
Most likely this is a numerical precision issue. If you round it to the nearest integer and format it should work as expected.
time_char = put(round(time, 1), time8.);
FYI - I could not replicate your issue.
01-17-2017 02:32 AM
Assign a format of best32. to your time variable, and then look at the values; you will find that there is a small fractional aberration.
01-17-2017 07:36 AM
And once you've verified that you have a "numerical precision artifact" in your time value, just use the round() function to get rid of it.
timeval = round(timeval,.000001);
will remove a small fractional error while preserving time down to microseconds.