Date: Tue, 19 Nov 1996 06:44:06 +0000
Reply-To: John Whittington <johnw@MAG-NET.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: John Whittington <johnw@MAG-NET.CO.UK>
Subject: Re: Looking for Data Cleansing Macro
On Mon, 18 Nov 1996, Scott Blalock <sblalock@SCSN.NET> wrote:
>I am looking for anyone with (or a pointer to) a macro which given a
>dataset will give back any observations which have any variables which
>contain missing data (space for character and missing for numeric).
Scott, I'm not sure what you mean by 'give back any observations ....', but
something like the following simple DATA step code should put all such
observations into a data set for you - which you could print or process or
whatever:
data giveback (drop = i flag) ;
set yourdata ;
array _ch(*) _character_ ;
array _nu(*) _numeric_ ;
flag = 0 ;
do i = 1 to dim (_ch) ; if _ch(i) = '' then flag = 1 ; end ;
do i = 1 to dim (_nu) ; if _nu(i) = . then flag = 1 ; end ;
if flag = 1 ;
run ;
Any help?
John
-----------------------------------------------------------
Dr John Whittington, Voice: +44 1296 730225
Mediscience Services Fax: +44 1296 738893
Twyford Manor, Twyford, E-mail: johnw@mag-net.co.uk
Buckingham MK18 4EL, UK CompuServe: 100517,3677
-----------------------------------------------------------
|