BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

I've a code like below and it seems to be running as excepted. However, I could see a error message in SAS log for some reasons which I could not figure out.

 

data log.output_file ;
  infile "&path/output_file.txt" firstobs=2 truncover ;
  input fname $400. ;
run;


%macro sas_log_analysis;
data log.log_analysis;
set log.output_file;
filename=fname;
length fname $400;
infile dummy dsd truncover FILEVAR = fname END = end_of_file LRECL=32000;
DO WHILE (not end_of_file);
input var : $ 3000.;
/*filename=fname;*/
var1 = _infile_;
if var1 = :'201' then do;
Date_TimeStamp= scan(var1,1," ");
output;
end;
end;
%mend sas_log_analysis;

%macro java_log_analysis;
data java;
set sashelp.class;
run;
%mend java_log_analysis;

%macro dotnet_log_analysis;
data dotnet;
set sashelp.class;
run;
%mend dotnet_log_analysis;


data _null_;
  set log.output_file;
  if fname =: '/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer' then call execute ('%sas_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_java' then call execute ('%java_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_dotnet' then call execute ('%dotnet_log_analysis;');
else put 'no log files';
run;

data _null_;
  set log.output_file;
  if fname =: '/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer' then call execute ('%sas_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_java' then call execute ('%java_log_analysis;');
  else if fname =: '/usr/sas/tir/test/loganalysis/temp_dotnet' then call execute ('%dotnet_log_analysis;');
else put 'no log files';
run;

Log.output_file has records like follows.

 

fname
/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-10-04_19142.log
/usr/sas/tir/test/loganalysis/temp_java.log
/usr/sas/tir/test/loganalysis/temp_dotnet.log

 

For testing purpose, I've created a empty log files as temp_java.log and temp_dotnet.log. Could someone tell me that these two empty log files are root cause for the error?

NOTE: There were 5472 observations read from the data set LOG.LOG_ANALYSIS.
NOTE: The data set WORK.LOG_TABLE_FINAL has 5472 observations and 7 variables.
NOTE: The PROCEDURE REPORT printed pages 1-406.
NOTE: PROCEDURE REPORT used (Total process time):
      real time           5.47 seconds
      cpu time            5.43 seconds
      

13        + close;  ods listing;  ods listing close;;
14        + data java;  set sashelp.class;  run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
12                                                         The SAS System                              06:17 Monday, October 5, 2015

NOTE: The data set WORK.JAVA has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

14        +                                     ;
15        + data dotnet;  set sashelp.class;  run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.DOTNET has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

15        +                                       ;
267        

ERROR: Errors printed on page 6.
4 REPLIES 4
Quentin
Super User
Hi, it looks like you have cut out the key portion of your log (log line 16 through 266 are missing). If you would at those lines, you should see an ERROR: message. If you need help understanding the message, please post that section of the log.
The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
Babloo
Rhodochrosite | Level 12
I did not missed anything between the lines16 to 276 as I copy/paste it from log window. Nothing in between the line 15 and 265. I don't see any error before that.
Quentin
Super User
Well, then I'm flummoxed. You mean the log skips from line 15 to line 267? Are you submitting this code via EG? If so, suggest you turn on the options to the EG-added wrapper code. Also suggestion you turn on options mprint and source2. SAS clearly thinks it printed an error somewhere.
The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
Patrick
Opal | Level 21

You need to expand the "plus" as else you're hiding the relevant parts of the log.

Capture.PNG

 

As for the code you've posted: I can run it without errors as long as the files listed in "output_files.txt" files exist.

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
  • 4 replies
  • 1298 views
  • 0 likes
  • 3 in conversation