Date: Fri, 20 Mar 2009 04:33:36 -0400
Reply-To: Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject: Re: Testing for the existence of a dataset with more than 0
To test for the existence of a dataset is done with the SAS function EXIST.
See your SAS documentation on examples of use, also in SAS macro code.
To check the amount of records is done with the option NOBS=variable of the
SET statement. See your documentation.
%LET Check = %SYSFUNC(EXIST(dataset));
%LET NofCases = ;
%IF (&Check EQ 1) %THEN %DO;
IF 0 THEN SET dataset NOBS=NofCases;
CALL SYMPUT ('NofCases', LEFT(PUT(NofCases,8.)));
%PUT Existence of dataset = &Check;
%PUT Dataset has &&NofCases number of records;
Regards - Jim.
Jim Groeneveld, Netherlands
Statistician, SAS consultant
My computer, my wife and I will attend SGF 2009 near Washington.
On Thu, 19 Mar 2009 21:05:13 -0400, David Friedman
>If I wanted to test both the existence of a dataset and also to make sure
>it was not empty what is the best way to accomplish this. I have SAS 8.2