question

Upvotes
Accepted
18 1 1 3

Convert numeric value into time (millisecond) in SAS

please advise on how to convert the numeric value into time using SAS software. I am using the market depth (TRTH), and the time is shown in numeric. For example, 48600044.

Thanks

tick-history-rest-apifields
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
11.3k 25 8 14

@arze.karam

I understand that you want to interpret value in the "BID_TIM_MS" field. The "_MS" field is a millisecond time field. The field represents the number of milliseconds past midnight GMT. The field is in Integer data format.

For example the 13:30:0:044 can be converted from 48600044 milliseconds. Below is how the value is generated.

Hour: 13 * ( 60 * 60 * 1000 ) = 46800000 milliseconds
Minute: 30 * ( 60 * 1000 ) = 1800000 milliseconds
Second: 0 * ( 1000 ) = 0 milliseconds
Millisecond: 44 milliseconds
Total: 46800000 + 1800000 + 0 + 44 = 48600044 milliseconds.

To interpret values of the millisecond time field, you can use the following formula.
int msec = time_ms%1000;
int seconds = (((int)(time_ms/1000)) % 60);
int minutes = (((int)(time_ms/60000)) % 60);
int hours = (((int)(time_ms/3600000)) % 24);

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
15.2k 40 12 19

Hi @arze.karam, Please contact vendor the support on conversion. I see that SAS has community support at https://communities.sas.com.

We can only help with Refinitiv API related questions.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks. Will do