LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2010, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 22 Mar 2010 20:37:49 -0700
Reply-To:     Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Tom Abernathy <tom.abernathy@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: An unsuccessful attempt to parse the SAS logfile for a
              WARNING-message
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Here is one obvious problem line: if substr(Logtext,1, 5) eq "WARNING" and ....

The first five characters cannot equal a seven letter word.

Note it is easier to use the : modifier on the = operator than use the SUBSTR function.

if logtext =: 'WARNING' ....

On Mar 22, 7:36 pm, Anaconda <r...@fastlane.no> wrote: > Hi, > > I am a bit confused why I get an empty dataset of SASLOG_EXTRACT > below. > The code can be pasted into the editor and submitted. > > data _null_; > %global mvar_timestamp; > day = date(); > time = time(); > sasdt = dhms(day, 0, 0, time); > length chardate $10.; > chardate = put(day, yymmdd10.); > length charsasdt $16.; > charsasdt = put(sasdt, datetime.); > length macvar_timestamp $19.; > macvar_timestamp = substr(chardate, 1, 4) || '_' || > substr(chardate, 6, 2) || '_' || > substr(chardate, 9, 2) || '_' || > substr(charsasdt,9, 2) || '_' || > substr(charsasdt,12, 2) || '_' || > substr(charsasdt,15, 2) > ; > call symput('mvar_timestamp', macvar_timestamp); > *Testing; > put 'DAY:' day date9.; > put 'TIME:' time time.; > put 'SASDT:' sasdt datetime.; > put 'CHARDATE:' chardate; > put 'CHARSASDT:' charsasdate; > put 'MACVAR_TIMESTAMP:' macvar_timestamp; > %put MVAR_TIMESTAMP: &mvar_timestamp; > run; > > %let new_logfile_sas = D:\Temp\SASLOG_&mvar_timestamp._comlete.log; > %put NEW_LOGFILE_SAS = &new_logfile_sas; > filename newlog "&new_logfile_sas"; > > proc printto log = newlog; > run; > > /* Some code with errors */ > data a; > set sashelp.class; > run; > > data b; > /* Creating an error deliberately */ > set sashelp.class#¤%&%; > run; > > proc printto; > run; > > /* Creating a complete dataset of the SAS log file */ > data saslog_complete; > infile "&new_logfile_sas" lrecl = 300 missover pad; > length Linenr 8.; > Linenr = _N_; > input @1 Logtext $250. ; > run; > > /* > I don't understand why I get 0 observations in the dataset > SASLOG_EXTRACT below. > I would have expected the one record in linenr. 31 in the SAS log. > So why not? > */ > data saslog_extract; > length Type $20.; > length Language_Component $15.; > Type = " "; > Language_Component = " "; > set saslog_complete; > if substr(Logtext,1, 5) eq "WARNING" and > ( index(Logtext, "The data > set") > 0 and > index(Logtext, "may be > incomplete.") > 0 and > index(Logtext, "When this step was stopped there > were") > 0 and > index(Logtext, "observations > and") > 0 and > index(Logtext, > "variables.") > 0 > ) > then do; > Type = "WARNING"; > Language_Component = "SAS language"; > output; > end; > > run; > > Does anyone see what is wrong with my code? > > - Anaconda


Back to: Top of message | Previous page | Main SAS-L page