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

I have a very long program, that is taking too long. I figured I would read the LOG back into a data step to search for the steps where the elapsed time is high. In the LOG, you get lines such as 

 

      real time           0.02 seconds
      real time        1:16.09 seconds

so the first step of the program took 2 one-hundredths of a second, while the second step took one minute, 16 and 9/100 seconds.

 

How to read this in so that the numerical part is recognized as actual times? To simplify even further, here's some relevant code

 

data a;
input string $ 1-10;
elapsed_time = input(string,time10.2);
cards;
0.02
1:16.09
;

but this seems to turn the 0.02 from the first line into 120 seconds or 2 minutes. The second line isn't converted at all by the informat. What is the proper informat to use here? I want the first line to be converted to 0.02 seconds, and the second line to be converted to 1 minute, 16.09 seconds.

 

 

--
Paige Miller
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I think you want the STIMER. informat.

 

Read times in the format as written to the Log from the documentation.

View solution in original post

3 REPLIES 3
ballardw
Super User

I think you want the STIMER. informat.

 

Read times in the format as written to the Log from the documentation.

PaigeMiller
Diamond | Level 26

Great Caesar's Ghost! You are correct! I never heard of STIMER before. Thanks.

--
Paige Miller
dcmacedo
Obsidian | Level 7

My suggestion is always to consult the SAS documentation, or some reference document. For example:

Formats:

Informats:

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 802 views
  • 3 likes
  • 3 in conversation