Write and run SAS programs in your web browser

read hh:mm:ss.nnn

Reply
Occasional Contributor
Posts: 12

read hh:mm:ss.nnn

I have time data in format of hh:mm:ss:nnn. How can i read the data with interval of a minute from that data where nano seconds are inclusive.

 

Thanks,

 

Gobin

Super User
Posts: 7,465

Re: read hh:mm:ss.nnn

[ Edited ]

Use the INTNX function to increment by 'minute'. Edit: with alignment 'same'!

If your value is still stored in a character variable, use the time12.3 informat for conversion before applying the intnx function.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 12

Re: read hh:mm:ss.nnn

Thanks for the previous one. Further, is it possible to get the millisecond
value from hh:mm:ss.nnn time format in SAS. Actually i have the data that
differs on that milliseconds.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Super User
Posts: 7,465

Re: read hh:mm:ss.nnn

If you used the time12.3 as informat, your SAS time value will contain the milliseconds after the decimal point.

To extract only the milliseconds, do

milsecs = (timeval - int(timeval)) * 1000;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 276 views
  • 0 likes
  • 2 in conversation