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
;;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.