Read in CSV format file with time information, with format TIME20.3.
The time column has millisecond, like 9:15:30:050 (050 is the millisecond).
Here are hour/minute/second functions to use. Any function to fetch the millisecond information ?!
Try MOD() function: millisecond=mod( time ,1);
Try MOD() function: millisecond=mod( time ,1);
Does your time string actually look like this:
9:15:30:050
The default TIME informat cannot read this, because of the semicolon between the seconds and the fractional part.
So I ask: is this a typo, or do we need to take care of this non-standard time format?
Hello @hellohere
The time values should have a decimal point and not semicolon before milliSeconds.
With that the following code will work
data test;
informat tm time20.3;
format tm time20.3;
input tm;
time_milliS=mod(tm,1);
datalines;
9:15:30.050
;;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.