Prev: Multiply
Next: Simple sum in proc sql
From: =?ISO-8859-1?Q?Daniel_Fern=E1ndez?= on 29 Jan 2010 09:01 I am not really sure what you want and for what, perhaps you could try to code this inside your program: dm 'clear log'; Daniel Fernandez. Barcelona. 2010/1/29 Anaconda <rune(a)fastlane.no>: > I wonder if it is possible to empty the SAS log file while a session > is running. I mean the physical log file on disk, not the log view in > the application which can be cleared by the command dm 'clear log'; . > My need for this to be done, is to do processing directly on the log > file to search for certain patterns which may indicate that something > went wrong during the execution of some code. As far as I have > experienced, the log file is accumulating everything that is executed > during the session, a lot of which may not be of interest for my > prossessing purpose to detect fault and failures. > I have tried this: > data _null_; > infile '<the_file_path_to_the_log_file>'; > file '<the_file_path_to_the_log_file>'; > input; > put; > run; > but then SAS that the file is in use, and I get an ERROR message in > the log view. > > The alternative is to end the session, and start a new one and the > right away execute the code that I want to examine. But this shutdown > and restart is cumbersome. > > Anaconda >
From: Arthur Tabachneck on 29 Jan 2010 08:58 Rune, One option would be proc printo. Take a look at: http://www.sascommunity.org/wiki/Using_PrintTo_to_Save_Logs HTH, Art ------- On Fri, 29 Jan 2010 02:24:18 -0800, Anaconda <rune(a)FASTLANE.NO> wrote: >I wonder if it is possible to empty the SAS log file while a session >is running. I mean the physical log file on disk, not the log view in >the application which can be cleared by the command dm 'clear log'; . >My need for this to be done, is to do processing directly on the log >file to search for certain patterns which may indicate that something >went wrong during the execution of some code. As far as I have >experienced, the log file is accumulating everything that is executed >during the session, a lot of which may not be of interest for my >prossessing purpose to detect fault and failures. >I have tried this: >data _null_; > infile '<the_file_path_to_the_log_file>'; > file '<the_file_path_to_the_log_file>'; > input; > put; >run; >but then SAS that the file is in use, and I get an ERROR message in >the log view. > >The alternative is to end the session, and start a new one and the >right away execute the code that I want to examine. But this shutdown >and restart is cumbersome. > >Anaconda
From: xlr82sas on 29 Jan 2010 21:45 On Jan 29, 6:01 am, fdez...(a)GMAIL.COM (Daniel Fernández) wrote: > I am not really sure what you want and for what, > perhaps you could try to code this inside your program: > > dm 'clear log'; > > Daniel Fernandez. > Barcelona. > > 2010/1/29 Anaconda <r...(a)fastlane.no>: > > > > > I wonder if it is possible to empty the SAS log file while a session > > is running. I mean the physical log file on disk, not the log view in > > the application which can be cleared by the command dm 'clear log'; . > > My need for this to be done, is to do processing directly on the log > > file to search for certain patterns which may indicate that something > > went wrong during the execution of some code. As far as I have > > experienced, the log file is accumulating everything that is executed > > during the session, a lot of which may not be of interest for my > > prossessing purpose to detect fault and failures. > > I have tried this: > > data _null_; > > infile '<the_file_path_to_the_log_file>'; > > file '<the_file_path_to_the_log_file>'; > > input; > > put; > > run; > > but then SAS that the file is in use, and I get an ERROR message in > > the log view. > > > The alternative is to end the session, and start a new one and the > > right away execute the code that I want to examine. But this shutdown > > and restart is cumbersome. > > > Anaconda- Hide quoted text - > > - Show quoted text - Hi, Proc printto will let you close the running log and start another log. I have a little utility that I call at the end of my program. This utility closes the log, does a log scrub on the closed log and extracts and updates key meta data. The utility then reopens the log and puts the results of the log scrub at the end of the original log, along with a signature line for the programmer to sign. for more info see %macro meta and code at around line 16780 in utl_tipweb.txt http://homepage.mac.com/magdelina/.Public/utl.html /* T003000 A REGISTRY FOR SAS PROGRAMMERS */ - a very log section of code Here is the operative code where I close the current log and start filename zrqtn catalog "work.savlog.savlog.catams"; /* suspend the log so it can be read it */ proc printto log=zrqtn print="/dev/null"; run; Here is how I reopen and read the log Then I do things like look for all datasets read or written /* get datasets read or written */ data dtmtry.ddt_dtminpout; infile "&log"; input; file print; infile=lowcase(_infile_); if pramatch("/&ref../",infile)>0 then put _infile_;; run; /* I also get creation dates for SAS datasets */ %macro credte(que); rec+1; id = open(libdsn,'i'); pth=pathname(scan(libdsn,1,'.')); dte=put(attrn(id,'crdte'),best22.); dtepth=cats(dte,'@',pth,'@',libdsn); call symputx("&que"!!put(rec,3. -l),dtepth); rc = close(id); %mend credte; Then I close the throwaway log and reopen the original log proc printto; run; /* open the log and append useful information to the end of the log */ proc printto print="/dev/null" log="&log"; run; What is nice is that issueing the original proc printto suspended the log so that when I write to the log tthe information goes on the end of the log data _null_; set logfnd end=dne; if _n_=1 then do; putlog "**************************************************************** putlog "* putlog "* Summary of ACHME Check program and Important communications putlog "* putlog "**************************************************************** putlog /; end; if question in ("&tla._CHKERR1" "&tla._CHKERR2") then delete; if question=: "&tla._DSN" then do; mtadte=input(scan(answer, 1,'@'),best22.); dataset=scan(answer, 3,'.'); if question=:'&tla._DSNOUT' then do; answer=catx(' ',dataset,'dataset with creation date',put (mtadte,datet end; else if question=: '&tla._DSNINP' then do; answer=catx(' ',dataset,'dataset with creation date',put (mtadte,datet end; end; putlog question @24 answer; if dne then do; putlog /; putlog "**************************************************************** putlog "* putlog "* End of Summary of ACHME Check program and Important communica putlog "* putlog "**************************************************************** end; run;
|
Pages: 1 Prev: Multiply Next: Simple sum in proc sql |