LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
In-Reply-To:  <c2192a610701051249l30ea43b5sb282a7492a45e1fe@mail.gmail.com>
Content-Type: text/plain; format=flowed

proccontents@GMAIL.COM wrote: > >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 >if >a dataset has any observations if it has then I need to set it to another >dataset. > >sample code is > > data all ; > set a b c d e f g h i j ; >run; > >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 >them >then >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; end; run;

data all; set a b c d; run;

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.

HTH, David -- David L. Cassell mathematical statistician Design Pathways 3115 NW Norwood Pl. Corvallis OR 97330

_________________________________________________________________ Dave vs. Carl: The Insignificant Championship Series. Who will win? http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://davevscarl.spaces.live.com/?icid=T001MSN38C07001


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