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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.