Date: Fri, 12 Oct 2001 15:38:19 -0700
Reply-To: Dale McLerran <dmclerra@MY-DEJA.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dale McLerran <dmclerra@MY-DEJA.COM>
Subject: Re: PROC UNIVARIATE
Content-Type: text/plain
Rich,
Since you have on the NOPRINT option, you are really using proc
univariate only to return the maximum value of TERMTIME within
levels of UCID. You don't need to use univariate to do this.
A datastep will work just fine. In fact, a datastep will work
faster than univariate. Univariate requires a lot of overhead
to generate quantiles of the distribution, whether you examine
those quantiles or not. Also, univariate is computing a raft of
other statistics which you do not require. What follows is a
datastep approach to returning the maximum value of TERMTIME. The
datastep approach will not generate the warning which you are
getting from proc univariate.
data select / view=select;
set vrupost(where=(phase='V'));
run;
data vru;
retain vruterm;
set select;
by ucid;
if first.ucid then vruterm=.;
vruterm = max(vruterm, termtime);
if last.ucid then output;
keep ucid vruterm;
run;
Note that we need the where clause separated from the datastep
which does the first.ucid and last.ucid processing for the datastep
approach to be guaranteed to work. If a first.ucid or last.ucid
did not meed the where condition, then either VRUTERM would not
be properly initialized to missing, or a record would not be
output for that particular UCID.
By the way, what operating system and version of SAS are you running?
I generated some dummy data with very little range relative to the
mean value. The data which I dummy up can exhibit computational
problems (as the range of the data gets further and further
restricted, the variance of the data becomes inaccurately computed).
However, I never get the warning message which you report.
Dale
>Date: Thu, 11 Oct 2001 15:54:38 -0700
>Reply-To: Rich <shpzh2000@YAHOO.COM>
> Rich <shpzh2000@YAHOO.COM> PROC UNIVARIATE SAS-L@LISTSERV.UGA.EDU
>Dear all,
>
>I need to find the maximum value of a variable within a certain class
>of another variable. I used the following code to do it.
>
>proc univariate data=vrupost noprint;
> var termtime;
> by ucid;
> where phase = 'V';
> output out=vru max=vruterm;
> format vruterm datetime16.;
>run;
>
>The code works but I keep getting the following WARNING message in the
>LOG file. As a result I need to clean the LOG window from time to time
>in order to keep the program running.
>
>What should I do with this problem? Thanks in advance.
>
>Rich
>
>*****************************************************************
>WARNING: The range of variable TERMTIME is too small relative to its
>mean, numerical inaccuracies may occur. Recode if possible.
>****************************************************
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@fhcrc.org
Ph: (206) 667-2926
Fax: (206) 667-5977
---------------------------------------
------------------------------------------------------------
--== Sent via Deja.com ==--
http://www.deja.com/