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