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

If anyone knows how to prevent the line numbers from being displayed in the Log Window, please let me know.
I'm using Windows SAS 9.4 TS1M6 (DMS).

 

I'm trying to detect differences in the submit log, but when code is inserted in the middle of the program, all subsequent line numbers are shifted and I can't detect the differences correctly.

1 ACCEPTED SOLUTION

Accepted Solutions
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @japelin 

 

This topic has been adressed earlier, try a google search on "sas suppress line numbers in log". The conclusions is that it can't be done unless you write a small SAS program to read a log file, remove the line numbers and write the result to another file. Do that on both log files and compare the output files. I use Notepad++ with the compare plugin installed, and it works perfectly.

 

I suggest that you also remove the title lines, because they are a disturbing element in the comparison. A program like this should do the work:

 

filename logfile "&logfile";
filename cleaned "&cleaned";
data _null_;
	infile logfile;
	file cleaned;
	input;
	if index(_infile_, '     The SAS System     ') then delete;
	if notdigit(scan(_infile_,1,' ')) = 0 then do;
		firstblank = index(_infile_, ' ');
		substr(_infile_, 1, firstblank-1) = '';
	end;
	put _infile_;
run;
	

View solution in original post

5 REPLIES 5
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @japelin 

 

This topic has been adressed earlier, try a google search on "sas suppress line numbers in log". The conclusions is that it can't be done unless you write a small SAS program to read a log file, remove the line numbers and write the result to another file. Do that on both log files and compare the output files. I use Notepad++ with the compare plugin installed, and it works perfectly.

 

I suggest that you also remove the title lines, because they are a disturbing element in the comparison. A program like this should do the work:

 

filename logfile "&logfile";
filename cleaned "&cleaned";
data _null_;
	infile logfile;
	file cleaned;
	input;
	if index(_infile_, '     The SAS System     ') then delete;
	if notdigit(scan(_infile_,1,' ')) = 0 then do;
		firstblank = index(_infile_, ' ');
		substr(_infile_, 1, firstblank-1) = '';
	end;
	put _infile_;
run;
	
japelin
Rhodochrosite | Level 12

Thank you.
I couldn't find it successfully by searching in Community, but I should have googled it first.

 

In addition, when I tried it in my environment, there was a case where it failed.

When I submitted proc options in a Japanese environment, there was a case where it started with a space followed by a number like this.

2021-12-19_02h49_13.png

 

I think this is a rare case, but assuming the above, I built it as follows.

 

data _null_;
  length f $1 i $10;
  infile logfile;
  file cleaned;
  input;
  f=subpad(_infile_,1,1);
  i=trim(scan(_infile_,1,' '));
  if input(f,??best.) and 
     input(i,??best.) then do;
    firstblank=length(i)+1;
    substr(_infile_,1,firstblank-1)='';
  end;
  put _infile_;
run;

 

 

It took an extra 20% of processing time, but it took just over a second when I tested it on a log of 1.72 million lines, so it was well within the acceptable range.

 

ballardw
Super User

What exactly are you trying to determine. "Differences" is a pretty broad topic in general and parsing logs may not be the best way.

Tom
Super User Tom
Super User

Not sure about the line numbers.

 

There is an option called GENERIC that will remove a lot of the run specific filenames from the log and so make comparing the logs easier.

693   option generic;
694   filename csv temp;
695
696   data _null_;
697     file csv dsd ;
698     set sashelp.class;
699     put (_all_) (+0);
700   run;

NOTE: The file CSV is:
      (system-specific pathname),
      (system-specific file attributes)

NOTE: 19 records were written to the file (system-specific pathname).
      The minimum record length was 17.
      The maximum record length was 21.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds

I think there is a way to reset the line numbers.  So if you insert that option after the place where the code diverges the line numbers should start synch up again.

japelin
Rhodochrosite | Level 12
Putting a RESETLINE in every process just for the log is not very desirable for a program, so I choose to process the log.
However, the GENERIC option is very useful for what I am trying to do.
Thank you very much.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2643 views
  • 0 likes
  • 4 in conversation