Date: Thu, 27 Oct 2005 20:47:07 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Min function
In-Reply-To: <1130444160.557259.82720@g14g2000cwa.googlegroups.com>
Content-Type: text/plain; format=flowed
Greg ,
Consider using SQl:
Proc sql ;
create table minbtotal as
select countid , min(btotal) as MinBtotal
from vendor
group by countid ;
quit ;
or if you want:
data MinBtotal ;
set vendor ;
by countid ;
retain Lowest ;
if first.countid then do ;
Lowest = Btotal ;
end ;
else do ;
if ( Lowest > Btotal ) then Lowest = Btotal ;
end ;
if last.countid then output ;
run ;
The data step solution is a little verbose but should work.
Toby Dunn
From: Greg Curson <gscsrc@HOTMAIL.COM>
Reply-To: gscsrc@HOTMAIL.COM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Min function
Date: Thu, 27 Oct 2005 13:16:00 -0700
I would like to get the lowest value of every different contid,
but below its giving me every value in bdtotal, so how do I change
it to give me what I need?
data minbdtotal;
set vendor;
keep contid vendor bdbstat bdtotal lowest;
by contid;
lowest = MIN(bdtotal,lowest);
run;