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.
I think you want the STIMER. informat.
Read times in the format as written to the Log from the documentation.
I think you want the STIMER. informat.
Read times in the format as written to the Log from the documentation.
Great Caesar's Ghost! You are correct! I never heard of STIMER before. Thanks.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.