Date: Fri, 5 Jan 2007 23:42:46 -0800
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: How to check if dataset has any obs or not
Content-Type: text/plain; format=flowed
>I am working on program where I need to make one dataset (set them ) out of
>10 datasets. I need to pick datasets with observartions. How can I check
>a dataset has any observations if it has then I need to set it to another
>sample code is
> data all ;
> set a b c d e f g h i j ;
>if b c do not have data I do not want to set them. For this
>1) I need to find if the dataset is empty or not then with out opening
>2) set them to all dataset .
>How can I do this .
>thanks for the help
I'm obviously missing something important here.
If B and C have no records, then there's no harm in leaving them
in the SET statement. You just won't get any records from
them.. which is just as you wanted.
Try this simple code:
data a b c d;
retain x1 x2 x3 x4 42 y5 y6 'blargh';
do i=1 to 6;
if i<3 then output a;
else output d;
set a b c d;
Check the log. B and C have no records. SAS does not care a
bit when it reads in the data sets.
So I don't think you need to sweat over this issue, unless there is
some other problem you have yet to share with us.
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
Dave vs. Carl: The Insignificant Championship Series. Who will win?