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

Hello,

I am trying to run the "LOG Scanner Program" which is provided in the extended learning section of Programming 2. Here is the code:

/*Change the following macro variables*/

%let logpath =/*Log file directory*/;
%let filename = /*Log file full name*/;

data logdata;
   retain flag 0;
   drop flag;
   infile "&logpath.\&filename" truncover end=last;
   logfile = "&filename";
   line+1;
   input text $1024.;
   if (    find(text, 'ERROR:')  
        or find(text, 'WARNING:') 
        or find(text, 'REPEATS OF BY VALUES','i') 
        or find(text, 'UNINITIALIZED','i') 
        or find(text, 'FORMAT WAS TOO SMALL','i') 
        or find(text, 'HAVE BEEN CONVERTED TO','i') 
        or find(text, 'INVALID ARGUMENT','i') 
        or find(text, 'OPERATIONS COULD NOT BE PERFORMED','i') 
        or find(text, 'BECAUSE OF ERRORS','i')
        or find(text, 'SYNTAX CHECKING MODE','i')
       )
       and not index(text, 'NO MATCHING MEMBERS IN DIRECTORY') then
      do;
         flag = 1;
         output;
      end;
   else if last and flag = 0 then
      do;
         text = '(none)';
         output;
      end;
   label text='Log entry requiring explanation';
run;

title "Errors, warnings and notes in the SAS log requiring justification:";
proc sql;
select * from logdata;
quit;

My questions is where can I find "Log file directory" and "log file full name" to be able to run this program.

Thank you,

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @Avideh and welcome to the SAS Support Communities!

 

This program is designed to read a SAS log that has been saved as a text file. You can save the contents of the Log window manually ("Save as...") or use PROC PRINTTO or the ALTLOG system option to route (a copy of) the log automatically to an external file. You can also run a program in batch mode and specify the path for the log in the LOG system option.

 

If the log is stored in, say, C:\Temp\my_program.log, you specify

%let logpath = C:\Temp;
%let filename = my_program.log;

and submit the "LOG Scanner Program" including these macro variable definitions.

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hello @Avideh and welcome to the SAS Support Communities!

 

This program is designed to read a SAS log that has been saved as a text file. You can save the contents of the Log window manually ("Save as...") or use PROC PRINTTO or the ALTLOG system option to route (a copy of) the log automatically to an external file. You can also run a program in batch mode and specify the path for the log in the LOG system option.

 

If the log is stored in, say, C:\Temp\my_program.log, you specify

%let logpath = C:\Temp;
%let filename = my_program.log;

and submit the "LOG Scanner Program" including these macro variable definitions.

Avideh
Calcite | Level 5
Thank you!

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
  • 2 replies
  • 970 views
  • 1 like
  • 2 in conversation