LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 1997, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 16 May 1997 08:59:32 PDT
Reply-To:     TWB2%Rates%FAR@GO50.COMP.PGE.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         TWB2%Rates%FAR@GO50.COMP.PGE.COM
Subject:      Re: stopping a job due to empty datasets

Lydia, If the dataset is actually empty (zero obs), then checking for _N_ EQ 1 would never succeed. One approach, assuming the input dataset is on disk, is the NOBS option:


Did you want to stop the datastep (as I showed above), or the job step? To stop the job I believe you can replace the STOP with ABORT above (or even ABORT ABEND nn to have the job return step completion code nn).

If the input dataset is on tape, NOBS will not work. Then I suggest:

%let hasinput=NO; DATA _NULL_; SET MYINPUT; CALL SYMPUT("hasinput","YES"); STOP; RUN;

%macro maystop; %if &hasinput EQ NO %then %do; %* Whatever you want to do about zero input goes here; %end; %mend maystop; %maystop;

Tim Berryhill - Contract Programmer and General Wizard TWB2@PGE.COM or Frequently at Pacific Gas & Electric Co., San Francisco The correlation coefficient between their views and my postings is slightly less than 0 ----------------------[Reply - Original Message]----------------------

Sent by:Lydia Pettis <LRP@CORNELLC.CIT.CORNELL.EDU> I have a sas job with multiple data steps. Twice a year the job bombs because the last data step uses variables that are carried over from a previous step, and if the set from the previous step is empty we get error messages which result in a return code of 8 when executing on the mainframe.

Is there some way to cleanly stop execution of a sas step if the data sets it is reading are empty? Can you check for missing values for instance at the beginning of the step? Like 'if _n_ = 1 and variable = '.' then stop'? (unfortunately my sample dataset got overwritten before I had a chance to copy it for testing).

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * LYDIA PETTIS INTERNET: * * Library Technology Dept. * * B40 Olin Library * * Cornell University PHONE: (607) 255-9477 * * Ithaca, NY 14850 FAX: (607) 255-9346 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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