LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Sep 2008 22:36:38 -0400
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>"
              <schreier.junk.mail@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>"
              <schreier.junk.mail@GMAIL.COM>
Subject:      Re: Replacing with minimum
Content-Type: text/plain; charset=ISO-8859-1

On Tue, 9 Sep 2008 05:48:48 -0500, ./ ADD NAME=Data _null_, <iebupdte@GMAIL.COM> wrote:

>Indeed it is... > >data a; > input a @@; > cards; >10 . 2 31 . 42 1 3 . >;;;; > run; >proc stdize method=range reponly out=min; > run; >proc print; > run;

Also easily done in Base SAS, for example with a self-concatenation:

data min; set a a(in=secondpass); min_a = min(a,min_a); retain min_a ; drop min_a ; a = coalesce(a,min_a); if secondpass; run;

or with SQL:

proc sql; create table min as select coalesce( a, min(a) ) as a from a; quit;

> > >On 9/9/08, Sierra Info Services <sfbay0001@aol.com> wrote: >> I think this functionality is available in PROC STDIZE, added to SAS/ >> STAT in V 8 >> >> >> Hope this helps... >> >> Andrew >> >> On Sep 9, 3:48�am, shashi <shashi2...@gmail.com> wrote: >> > Hi, >> > Here I have a query. >> > My data contains a variable 'a' alone. I want to replace the missings >> > with the minimum of all the values(Assume there are no 0's in the >> > data) among all the observations. >> > >> > a >> > >> > 10 >> > . >> > 2 >> > 31 >> > . >> > 42 >> > 1 >> > 3 >> > . >> > >> > That is my data should look like: >> > >> > a >> > >> > 10 >> > 1 >> > 2 >> > 31 >> > 1 >> > 42 >> > 3 >> > 1 >> > >> > where I replaced the missings with the minimum i.e. 1 here. >> > Could anybody help a way in this regard? >>


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