BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hellohere
Pyrite | Level 9

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 ?!

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Try MOD() function:

millisecond=mod( time ,1);

View solution in original post

5 REPLIES 5
hellohere
Pyrite | Level 9
second() can do that, actually.
Ksharp
Super User
Try MOD() function:

millisecond=mod( time ,1);
Kurt_Bremser
Super User

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?

hellohere
Pyrite | Level 9
Yeah, you guys are right. it is . not :
Sajid01
Meteorite | Level 14

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: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 605 views
  • 1 like
  • 4 in conversation