BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
milts
Pyrite | Level 9

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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

View solution in original post

5 REPLIES 5
Ksharp
Super User

Can you post some LOG information and CODE you used and OUTPUT you need ?

milts
Pyrite | Level 9

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!

Ksharp
Super User

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

Ksharp
Super User

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

milts
Pyrite | Level 9

Got the desired output. Thank you very much for the help.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 5 replies
  • 1321 views
  • 0 likes
  • 2 in conversation