Date: Thu, 25 Jan 2001 11:54:47 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: Proc Univariate question
Content-Type: text/plain; charset="iso-8859-1"
> From: Chelsea [mailto:admin.ra@IOIP.COM]
> I want to do Proc Univariate on 62 vriables in a dataset. But the data
have
> some invalid values like "88888" or "888888" in them. I wonder if I can
> simply use a "Where" statement in the Proc Univariate to get
> rid of these invalid values, so that they will not show in the final
output.
the where statement is the way to go if you have just one var and one
invalid value.
proc UNIVARIATE data = LIBRARY.WHATEVER
(where = (Var ne 88888));
hm, you quoted the invalid values, does that mean they are character
variables?
(where = (Var ne '88888'));
(where = (Var not in('88888','888888'));
another way that I use to select all invalid values is with a format:
%LET BLANK=BLANK;
%LET INVALID=INVALID;
proc FORMAT;
value InRange
.= "&BLANK."
1 - 4 = 'ok'
other = "&INVALID.";
then I can exclude the outliers with this statment:
(where = (put(Var,InRange.) ne "&INVALID."));
or exclude blank and invalid:
(where = (put(Var,InRange.) not in ("&BLANK.","&INVALID."));
and this would be a good place for an ad for my
SUGI26 Beginning Tutorials paper:
A Beginner's Tour of a Project using SAS(r) Macros
where I review such trivia as whether to put the macro variables BLANK &
INVALID
in the autoexec, or in an %include file.
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
OpSys: WinNT Ver: 8.1
---> cheerful provider of UNTESTED SAS code!*! <---
e-mail your SAS improvements to: suggest@sas.com
archives: http://www.listserv.uga.edu/archives/sas-l.html
By using your intelligence you can sometimes make your problems twice as
complicated.
-- Ashleigh Brilliant