Date: Thu, 20 May 2010 08:40:58 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: How to delete observations with all variables missing?
In-Reply-To: <AANLkTinZxslakHNumAzRMyrbXGyePnWuuImkFQNOsw5w@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Yes of course you are correct, if the starting point is a SAS data set.
On 5/20/10, Joe Whitehurst <joewhitehurst@gmail.com> wrote:
> I'm curious. Wouldn't it be move efficient to put either of these functions
> in a where clause to prevent observations with all missing values for being
> loaded into the PDV at all?
>
> On Thu, May 20, 2010 at 7:06 AM, Yuewei Liu <elek.liu@gmail.com> wrote:
>
> > Data _null_, very cool... Thank you very much.
> >
> > Yuewei
> >
> > On Thu, May 20, 2010 at 6:21 PM, Data _null_; <iebupdte@gmail.com> wrote:
> >
> > > if missing(cats(of _all_)) then delete;
> > > You will need the system option MISSING=' ';
> > >
> > > or
> > >
> > > if missing(coalesce(of _numeric_))
> > > and missing(coalesceC(of _character_)) then delete;
> > >
> > > On 5/20/10, Yuewei Liu <elek.liu@gmail.com> wrote:
> > > > Hi all. How to delete the observation, if all values of all the
> > variables
> > > > are missing? I did it using the Array statements. Do you have some
> > better
> > > > ideas?
> > > > Any suggestions are appreciated.
> > > >
> > > > data have;
> > > > input x y;
> > > > length z $ 8;
> > > > z=ifc(y=.," ",strip(put(y,best.)));
> > > > cards;
> > > > 1 2
> > > > 3 1
> > > > 4 2
> > > > 3 .
> > > > 3 3
> > > > . 2
> > > > . .
> > > > 3 .
> > > > . .
> > > > . 2
> > > > . .
> > > > ;
> > > > data want(drop=tag i j);
> > > > set have;
> > > > array num [*] _numeric_;
> > > > array char[*] _character_;
> > > > tag=0;
> > > > do i=1 to dim(num);
> > > > if num[i]^=. then do;
> > > > tag=1;
> > > > return;
> > > > end;
> > > > end;
> > > > do j=1 to dim(char);
> > > > if char[j]^=" " then do;
> > > > tag=1;
> > > > return;
> > > > end;
> > > > end;
> > > > if tag=1;
> > > > run;
> > > >
> > > > Yuewei
> > > >
> > >
> >
>
|