Date: Tue, 20 Nov 2001 14:05:00 +0000
Reply-To: John Whittington <John.W@MEDISCIENCE.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: John Whittington <John.W@MEDISCIENCE.CO.UK>
Subject: Re: Missing Values
In-Reply-To: <E166B7n-0001RA-00@relay1.netnames.net>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 08:38 20/11/01 -0500, Tift, Brian wrote:
>Thanks to everyone for the suggestions, the main problem was that
>there was a long series of variables (~50) that the user wanted to run.
>The solution we came up with was from off the list,
>not the cleanest solution but it works.
>
>data temp; set test;
>array test _numeric_;
> do i=1 to dim(test);
> if test(i) in (888,999) then test(i) = .;
> end;
>proc print; run;
>
>proc means data=temp; run;
Brian, that's certainly the 'most obvious way' - but unless you really
want/need to (or are using this 'modified dataset' repeatedly), there is no
actual need to create your dataset 'temp' - with just a very slight
addition to your code, you could make it a 'view' of the original dataset:
data temp / view = temp ;
set test;
array test _numeric_;
do i=1 to dim(test);
if test(i) in (888,999) then test(i) = .;
end;
run ;
proc print data = temp ; run;
proc means data=temp; run;
Kind Regards
John
----------------------------------------------------------------
Dr John Whittington, Voice: +44 (0) 1296 730225
Mediscience Services Fax: +44 (0) 1296 738893
Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk
Buckingham MK18 4EL, UK mediscience@compuserve.com
----------------------------------------------------------------
|