LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments:   To: gscsrc@hotmail.com
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;


Back to: Top of message | Previous page | Main SAS-L page