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 (February 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 22 Feb 2006 17:33:49 -0500
Reply-To:   "Droogendyk, Harry" <harry.droogendyk@RBC.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Droogendyk, Harry" <harry.droogendyk@RBC.COM>
Subject:   Re: Current PROC PRINTTO log file??
Content-Type:   text/plain; charset="iso8859-1"

SASHELP.VEXTFL contains the log file path in interactive mode when the log has been redirected. So, it could be loaded into a macro variable using SQL into:

Not sure what sashelp.vextfl contains when executed in batch.

proc printto log='c:\temp\test.log'; run;

title 'LOG= external file'; proc print data=sashelp.vextfl; where xpath like '%log%'; run;

/* Output */

LOG= external file

Obs fileref xpath xengine

5 #LN00009 c:\temp\test.log

proc printto; run;

/* This print returns zero rows */ title 'LOG=LOG'; proc print data=sashelp.vextfl; where xpath like '%log%'; run;

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Lorne Klassen Sent: 2006, February, 22 5:23 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Current PROC PRINTTO log file??

Yes, I had checked the LOG= option using PROC OPTIONS but was wondering why it didn't show anything. It is because I'm not running in batch mode. This explains it:

"Specifies a destination to which the SAS log is written in batch or noninteractive mode".

So is this information accessible somewhere else in interactive mode?

On Wed, 22 Feb 2006 17:08:53 -0500, Michael Raithel <michaelraithel@WESTAT.COM> wrote:

>Dear SAS-L-ers, > >Lorne Klassen posted the following interesting question: > >> I'm using PROC PRINTTO to redirect the log to a file before running >> three DATA steps. Then I redirect the log back to the log window and >> parse the log file to check for errors (don't ask...it has to be done

>> this way). This works, but the problem is related to re-directing the

>> log back to the log window (using LOG=LOG). >> >> The problem is that before this section of code was submitted, the >> log may have already been directed to a particular log file, not the >> window. In this case, I do not want to simply redirect the log back >> to the log window at the end. I really want to direct the log back to

>> the file it was originally being written to. But I want to write the >> code generically such that I don't have to keep track of the last log

>> file. In some cases, I may have been originally writing to the log >> window, not to a file at all. >> >> So what I need is some way to get the file that the log is currently >> being directed to, or, "LOG" if it is currently going to the log >> window. I couldn't find an option that stores this value. I'm using >> 9.1. >> > >Lorne, whoa; what an interesting question! This is the type of problem

>that I _LOVE_ to tackle! > >I have a kind-of solution that may get you some part of the way there... >but not entirely. Perhaps you, or other SAS-L-ers, can build on it. >(Yea, sure; watch some SAS-L brainiac come along and nail this one >right off the bat)! > >The SAS LOG option "Specifies a destination to which the SAS log is >written in batch or noninteractive mode". So, if you were to run the >following SAS program, named SAS_TEST_Program.sas in batch: > >proc printto log="c:\tempfile.log"; >run; > >proc options;run; > >proc printto;run; > >... and then look at the PROC OPTIONS output in c:\tempfile.log, you >would see something like this: > >LOG=C:\SAS_Test_Program.log > >So, you could use this to your advantage by querying the value of the >LOG option. You would capture it in a macro variable and save it for >later. When you wanted to switch the log back, you would use the value

>of the macro variable as the "new" destination--though it is really the

>old destination back again. Yea, this sounds good, but, again, this >methodology could only work in BATCH:-( > >Lorne, best of luck getting a better answer from the SAS-L cast of >thousands! > > >I hope that this suggestion proves helpful now, and in the future! > >Of course, all of these opinions and insights are my own, and do not >reflect those of my organization or my associates. All SAS code and/or >methodologies specified in this posting are for illustrative purposes >only and no warranty is stated or implied as to their accuracy or >applicability. People deciding to use information in this posting do so

>at their own risk. > >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >Michael A. Raithel >"The man who wrote the book on performance" >E-mail: MichaelRaithel@westat.com > >Author: Tuning SAS Applications in the MVS Environment > >Author: Tuning SAS Applications in the OS/390 and z/OS Environments, >Second Edition >http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172 > >Author: The Complete Guide to SAS Indexes >http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409 > >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >Don't be too timid and squeamish about your actions. All life is an >experiment. The more experiments you make the better. >- Ralph Waldo Emerson >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ _______________________________________________________________________

This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.


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