*
; /* Vicki Cook wrote: > > I have just started programming in SAS this year and I am still looking > for some basic programming features. Does anyone know how to determine > if a SAS file is empty within the program itself. In other words when my > program is passing data from proc to data steps at a certain point I want > the code to check if the incoming file is empty and do something within > the data step. Perhaps there is SAS keyword for this? > > Any help would be appreciated... > > Vicki -- Vicki, Here is a MACRO we use here to determine if the dataset has any observations. Try it out... -------------------------------------------------------------------------- Kimball R. Cook The opinions expressed are StorageTek, Louisville CO USA those of my own and do not kimball_cook@stortek.com reflect those of my employer. snip------*/ %macro numobs (lib,dsn); %global num; %let num=0; proc sql noprint; select (nobs-delobs) into :num from dictionary.tables where libname="%upcase(&lib)" and memname = "%upcase(&dsn)"; %let num=# %if &num=0 /* inserted by Arnold Schick */ %then %put MACRO-NOTE: The data set %upcase(&dsn) in library %upcase(&lib) is empty or does not exist.; %else %put MACRO-NOTE: The data set %upcase(&dsn) in library %upcase(&lib) has &num observations.; quit; %mend numobs; *;