Date: Thu, 23 Mar 2006 13:50:22 -0600
Reply-To: Nishant Dholakia <nishant.dholakia@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nishant Dholakia <nishant.dholakia@GMAIL.COM>
Subject: Re: title not printing
In-Reply-To: <OFD7D60DA2.348F9E15-ON8525713A.006AE0E1-8525713A.006B7543@dom.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi,
The macro that you suggested is something that I already wrote..the only
difference being that I wanted to use title as opposed to put statement in
order to output on the .lst file.
The put works fine and it does appear in the log however the problem was
with title which did not work because of the empty dataset.
Is there a better way to simply put in a line of text in the output file
when a particular condition is satisfied?
Thanks in advance
On 3/23/06, Nathaniel_Wooding@dom.com <Nathaniel_Wooding@dom.com> wrote:
>
> Nishant
>
> Note in your log where it says
>
> NOTE: No observations in data set WORK.LOG_FILE.
> NOTE: PROCEDURE PRINT used:
> real time 0.00 seconds
> cpu time 0.00 seconds
>
>
> Note that it does NOT say
>
>
> NOTE: THE PROCEDURE PRINT PRINTED PAGE 1.
>
>
>
> Which is what I normally see when in batch mode ( I just realized that
> interactive SAS under WIN XP does not give the pages printed information.)
> To the best of my knowledge, SAS does not print a blank page when it
> encounters an empty data set. What you can do is write a macro which you
> insert in place of the proc print. Have it first check to see whether
> there
> are obs in the data set that you want to print and then conditionally
> execute a proc print or a Data _null_ step which would use put statements
> to write out the desired message.
>
> Nat Wooding
>
>
>
>
>
>
> Nishant Dholakia
> <nishant.dholakia
> @GMAIL.COM> To
> Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
> Discussion" cc
> <SAS-L@LISTSERV.U
> GA.EDU> Subject
> Re: title not printing
>
> 03/23/2006 02:08
> PM
>
>
> Please respond to
> Nishant Dholakia
> <nishant.dholakia
> @GMAIL.COM>
>
>
>
>
>
>
> Hi,
> Thanks for the reply. I was doing it on non interactive mode. I did close
> the file and reopened it just to be sure.
>
> Here's an example to get my point across better
>
> *fyi : xxx is not empty*
>
> eg
> 108 proc print data=xxx(obs=0);
> 109 title "test";
> 110 run;
>
> NOTE: No observations in data set WORK.XXX
> NOTE: PROCEDURE PRINT used:
> real time 0.02 seconds
> cpu time 0.02 seconds
>
> Title is printed in this case.
>
> However when I do this (*here log_file is not empty*)
>
> %if &nob = %str(0) %then %do;
> %put NO ERRORS OR WARNINGS;
> proc print data=log_file (obs=0);
> title2 "NO WARNINGS OR ERROR IN CODE ";
> run;
> %end;
> **
>
> * LOG*
>
> MLOGIC(LOGCHECK): %IF condition &nob = 0 is TRUE
> MLOGIC(LOGCHECK): %PUT NO ERRORS OR WARNINGS
> NO ERRORS OR WARNINGS
> MPRINT(LOGCHECK): proc print data=log_file(obs=0) ;
> MPRINT(LOGCHECK): title2 "NO WARNINGS OR ERROR IN CODE ";
> MPRINT(LOGCHECK): run;
>
> NOTE: No observations in data set WORK.LOG_FILE.
> NOTE: PROCEDURE PRINT used:
> real time 0.00 seconds
> cpu time 0.00 seconds
>
> There is no title printed
>
> This is what baffles me.
>
>
> On 3/23/06, Venky Chakravarthy <swovcc@hotmail.com> wrote:
> >
> > Nishant,
> >
> > You are probably running interactively and have left overs from a
> previous
> > run. Look carefully, if you have a Title you should have something in
> the
> > body unless you do something fancy as in the second situation below.
> >
> > An empty data set will not print and should not be having a title
> printed
> > either. To confirm this close and open your SAS session (after saving
> what
> > you have :-).) and try to run the following as your first job.
> >
> > data test ;
> > x = "abcdefg" ;
> > stop ;
> > run ;
> >
> > title "This is an empty dataset" ;
> > proc print data = test ;
> > run ;
> >
> > On the other hand if you really want to print the title with no body try
> > the
> > following:
> >
> > options nodate nonumber ;
> > data test2 ;
> > x = " " ;
> > label x = "00"x ;
> > run ;
> >
> > title "This is NOT REALLY an empty dataset" ;
> > proc print data = test2 nobs label ;
> > run ;
> >
> > Venky Chakravarthy
> >
> >
> > On Thu, 23 Mar 2006 12:14:55 -0500, Nishant Dholakia
> > <nishant.dholakia@GMAIL.COM> wrote:
> >
> > >I was trying to write in a code to analyse the logs produced. The
> program
> > >works fine except for one minor issue. There is a proc print on an
> empty
> > >dataset because I want to print out a title and after execution the
> title
> > >does not print even though the proc print is executed.
> > >This is the interesting part of the log
> > >
> > >NOTE: No observations were selected from data set WORK.LOG_FILE.
> > >NOTE: There were 0 observations read from the data set WORK.LOG_FILE..
> > > WHERE (UPCASE(log)=:'WARNING') or (UPCASE(log)='ERROR');
> > >
> > >NOTE: PROCEDURE PRINT used:
> > > real time 0.00 seconds
> > > cpu time 0.00 seconds
> > >
> > >Now does this mean that the print was not executed because real time as
> > >well as cpu time is 0.
> > >I tried proc print on several other empty datasets with only title
> > >statementts and they run fine (as in the title is printed).
> > >
> > >Its just an interesting observation. Comments would be really welcome
> coz
> > i
> > >wont be able to sleep until I figure this one out...hope I am not doing
> > >something really silly.
> >
>
>
>
> --
> Nishant H. Dholakia
> 607 262 0860
>
> "its your attitude not your aptitude that determines your altitude"
>
>
>
> -----------------------------------------
> CONFIDENTIALITY NOTICE: This electronic message contains
> information which may be legally confidential and/or privileged and
> does not in any case represent a firm ENERGY COMMODITY bid or offer
> relating thereto which binds the sender without an additional
> express written confirmation to that effect. The information is
> intended solely for the individual or entity named above and access
> by anyone else is unauthorized. If you are not the intended
> recipient, any disclosure, copying, distribution, or use of the
> contents of this information is prohibited and may be unlawful. If
> you have received this electronic transmission in error, please
> reply immediately to the sender that you have received the message
> in error, and delete it. Thank you.
>
>
--
Nishant H. Dholakia
607 262 0860
"its your attitude not your aptitude that determines your altitude"
|