Hi,
I'm trying to experiment of extracting values from a SAS log. Given values like the ff:
3:15:35.88
0.05 (seconds)
When converted, I'm getting a wrong value for the 2nd one. Converted values are the ff:
11735.88
300
I used TIME. informat to read them from the log. I need help to properly convert values which are less than a second. Any thoughts?
Hi. I check the documentation. time. will take '.' as a delimiter, If you don't want it . using stimer.
data test;
infile 'c:\TEST.log' expandtabs;
input
@'real time' real_time : stimer8.
@'cpu time' cpu_time : stimer8.
;
format real_time cpu_time time8.;
run;
Ksharp
Can you post some LOG information and CODE you used and OUTPUT you need ?
Hi,
Below is the code i tried. Also attaching portion of the log.
data test;
infile '<path>/TEST.log';
input
@'real time' real_time : time8.
@'cpu time' cpu_time : time8.
;
run;
Kindly correct if I there is something wrong in my sample code. Thanks!
Hi.
It seems that SAS doesn't recognize 0.05 seconds.
Maybe you can try to use another informat anydttme. to overcome it.
It will generate a missing value.If you want a zero, You can code something to transform it .
data test; infile 'c:\TEST.log' expandtabs; input @'real time' real_time : anydttme32. @'cpu time' cpu_time : anydttme32. ; format real_time cpu_time time8.; run;
Ksharp
Hi. I check the documentation. time. will take '.' as a delimiter, If you don't want it . using stimer.
data test;
infile 'c:\TEST.log' expandtabs;
input
@'real time' real_time : stimer8.
@'cpu time' cpu_time : stimer8.
;
format real_time cpu_time time8.;
run;
Ksharp
Got the desired output. Thank you very much for the help.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.