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,
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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.