Hi All,

Earlier today we saw the LSF scheduler mark a job as failed because PROC EXPORT ran with 0 records (and set the SYSCC and SYSERR to 1012). This wasn't an problem as we knew that the note in the log would cause this to occurr.

This has made me think about how I'd handle the issue if it wasn't clear which of the notes in the log could cause LSF to flag a failiure or would set one of the various SAS system error/information macro variables.

What I think I'd like to have in that scenario is a table containing all the Errors, Warnings and Notes, along side which, if any, system flags they set.

Is anybody aware of such a resource existing (I couldn't find anything with some quick searches)?

Cheers, Will

asked 01 Dec '11, 09:39

WilliamDobson's gravatar image

accept rate: 36%

Not sure if this is what you are looking for, but you can save your log to a file (via PROC PRINTTO) and then parse it for the different kind of messages. I have such a macro I wrote, that I'm sharing with you, I didn't have time to translate all parameters and everything (it's in Spanish). But the basic idea is you output the log to a text file in your PC/server and then parse it using %logparse(text_file, output_dataset).

proc format;
value tipo_mensaje
1 = "Information"
2 = "Note"
3 = "Warning"
4 = "Critical Error"
5 = "Data Error"
6 = "Option Statement"
other = "Other"


logExtract - Extracts key information from the log

%macro logExtract(log, dsn_estadisticas);
data &dsn_estadisticas;
format tipo_mensaje tipo_mensaje.;
infile "&log" delimiter="01"x truncover;
length num_linea 8
tipo_mensaje 3
mensaje $ 255; 
input mensaje $;
num_linea = _N_;
if find(mensaje, "INFO: ") > 0 then do;
tipo_mensaje = 1; /* InformaciĆ³n */
else if find(mensaje, "NOTE: ") > 0 then do;
tipo_mensaje = 2; /* Notas */
else if find(mensaje, "WARNING: ") > 0 then do;
tipo_mensaje = 3; /* Advertencias */
else if find(mensaje, "ERROR: ") > 0 then do;
tipo_mensaje = 4; /* Errores graves */
else if find(mensaje, "_ERROR_=1") > 0 then do;
tipo_mensaje = 5; /* Errores de procesamiento de datos */
else if find(upcase(mensaje), "OPTIONS ") > 0 then do;
tipo_mensaje = 6; /* Opciones */

if tipo_mensaje > 0 then do;
%mend logExtract;

You can use this macro to parse your log and if you modify the macro you can output any system variables you need whenever necessary. Hope this helps.


answered 13 Feb '12, 21:07

biyectivo's gravatar image

accept rate: 20%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 01 Dec '11, 09:39

Seen: 3,096 times

Last updated: 13 Feb '12, 21:07

powered by OSQA