Date: Tue, 7 Dec 1999 19:34:02 +0100
Reply-To: peter.crawford@DB.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford <peter.crawford@DB.COM>
Subject: Need to detect empty file; How?
Content-type: text/plain; charset=us-ascii
Prepare a macro var to signify "not found". If your data step loop continues
past the SET statement, have a (once only) call symput() to signify "data
found". You could even use that macro var to switch between a proc print and a
data _null_ print "no data" message
/* the following demo is tested ***/
%let found= 0;
DATA SMALLFLE;
SET BIGFLE;
if _n_ = 1 then call symput( 'found', '1' );
WHERE SALRY > 10000;
RUN;
%put (found)=(&found);
/*now proc print or put message to print window*/
%let f1 =%str( proc print; run;);
%let f0 =%str( data _null_; file print; put "no data found";run; );
&&f&found;
Try that
Datum: 07.12.99 18:58
An: SAS-L@listserv.uga.edu
Antwort an: rdbaker@sympatico.ca
Betreff: Need to detect empty file; How?
Nachrichtentext:
The simple code following can create an empty data set sometimes, I
need to detect this and stop the next process.
DATA SMALLFLE;
SET BIGFLE;
WHERE SALRY > 10000;
RUN;
I know there is a simple method, but I am using SAS 6.12 and what I am
doing is not working.
Sample code would be appreciated.
Base SAS or SCL method or both would be very nice.
Thanks in advance.
Robin