Date: Mon, 14 Jan 2008 12:57:32 -0600
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: Delete emptry records
In-Reply-To: <200801141826.m0EH5INT023958@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
It is easy with one step, I just hadn't thought it all the way
through. Use a set that is not executed with drop=&keys and define 2
arrays, one _CHAR_ the other _NUMERIC_ to use as variable lists.
data work.test;
infile cards missover;
input id $2. (a b c) ($1.) x y z;
if missing(coalesceC(of _character_)) and missing(coalesce(of
_numeric_)) then delete;
cards;
01abc 1 2 3
02
03def 3 4 5
;;;;
run;
%let keys = id;
data work.noNullRecs;
if 0 then set work.test(drop=&keys);
array _c[*] _char_;
array _n[*] _numeric_;
set work.test;
if missing(coalesceC(of _c[*])) and missing(coalesce(of _n[*])) then delete;
run;
proc print;
run;
On Jan 14, 2008 12:26 PM, Andy Andrews <sas_andy@boosecat.com> wrote:
> The two-step solution is exactly what I had planned to do. I was going to
> drop the "key" fields b/c I already have them stored in a macro variable.
> Then any blank records would be deleted and any non-blank records would be
> kept with recno = _n_ (or similar) for merging purposes. If I run into
> problems or if it gets ugly, I'll post an example (can't get into SAS this
> very moment). Thanks!
>
>
> On Mon, 14 Jan 2008 11:21:52 -0600, data _null_, <datanull@GMAIL.COM>
> wrote:
>
>
> >Post some example data. You can still do it but you might have to
> >work a bit harder get the lists of variables to coalesce.
> >
> >A two step solution using the code I suggest would be to DROP the KEY
> >variables and create a data set of observations numbers that need to
> >be deleted.
> >
> >On Jan 14, 2008 11:10 AM, Andy Andrews <sas_andy@boosecat.com> wrote:
> >> Well technically all fields minus some key fields, though I could manage
> >> with all fields = missing.
> >>
> >> Thanks data _null_ - I'll give it a try!
> >>
> >>
> >> On Mon, 14 Jan 2008 08:29:00 -0800, Terjeson, Mark
> <Mterjeson@RUSSELL.COM>
> >> wrote:
> >>
> >> >Hi Andy,
> >> >
> >> >What is your definition of an empty record?
> >> >All fields set to missing? All fields except
> >> >for the key? other?
> >> >
> >> >
> >> >
> >> >Mark Terjeson
> >> >Senior Programmer Analyst, IM&R
> >> >Russell Investments
> >> >253-439-2367
> >> >
> >> >
> >> >Russell
> >> >Global Leaders in Multi-Manager Investing
> >> >
> >> >
> >> >-----Original Message-----
> >> >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> >> >Andy Andrews
> >> >Sent: Monday, January 14, 2008 8:20 AM
> >> >To: SAS-L@LISTSERV.UGA.EDU
> >> >Subject: Delete emptry records
> >> >
> >>
> >> >Hi all, I'm trying to delete empty records from a dataset. I feel this
> >> >should be simple to do, however I'm not getting it today. I can't
> >> >hardcode any column names as I'll need it for multiple datasets.
> >> >Thanks!
> >> >
> >> >AA
> >>
>
|