Date: Fri, 16 Aug 1996 18:36:21 +1000
Reply-To: "David H. Johnson" <djohnson@WERPLE.NET.AU>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: "David H. Johnson" <djohnson@WERPLE.NET.AU>
Subject: Re: No Observations in Data set
I suspect a macro, perhaps in your master library and invoked after
each datastep would be the solution. You need to initialise a value
of a macro like MRECOUNT to 0 in your programme with a GLOBAL
statement. Then call the macro with the dataset name in the macro
values, and run a print if the macro resolves to 0 still. Something
like the following untested code;
%MACRO CHECKDSN(MDSN=)
DATA _NULL_;
SET &MDSN.(NOBS=MRECS);
CALL SYMPUT('MRECOUNT',MRECS);
RUN;
DATA _NULL_;
IF &MRECOUNT=0 THEN DO;
FILE PRINT;
PUT "THIS PROGRAMME IS BEING TERMINATED";
PUT "THE DATASET &MDSN. HAD NO OBSERVATIONS.";
ABORT ABEND;
RUN;
%MEND CHECKDSN;
Most important you initialise MRECOUNT with a %LET to 0 in your
programme, AND make it GLOBAL. You can change the ABORT ABEND for
ENDSAS if you want a friendly termination. I use this step because
in a Production schedule it stops the scheduler from continuing with
a dependent programme! I find that always coding as if for Prod
systems means I can always migrate a test programme with few changes.
Good luck with this.
David H. Johnson
djohnson@werple.net.au
++: From: navdeep
++: Date: 13/8/1996 6:47:01PM
++: To: Multiple recipients of list SAS-L
++: Subject: No Observations in Data set
++:
++: Hi ,
++:
++: I need help in figuring out how to do the following thing :
++:
++: I want to get some kind of an output (any warning messages
++: or something like
++: that) whenever a data set gets created with no observations,
++: ie whenever there
++: is a note in the log saying that data work.xyz (for example)
++: has no
++: observations.
++:
++: One approach that I thought of is to read the log file
++: (infile it) and check to
++: see if it has the note and then to display a window or some
++: kind of an output.
++:
++: Is here a more elegant way to do so , maybe using if _n_ =0
++: ??
++: Any suggestions or comments will really be appreciated.
++:
++: TIA,
++: Navdeep
++:
++: