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:

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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