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 (October 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 24 Oct 2007 23:23:54 +0530
Reply-To:     Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Anindya Mozumdar <anindya.lugbang@GMAIL.COM>
Subject:      Re: How To : Find Max Decimals IN A VAR
Comments: To: Raj <ramesh.chakri@gmail.com>
In-Reply-To:  <1193247613.015257.193970@t8g2000prg.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

One quick and dirty solution I could think of -

data test; set xxxtest; z = put(t,best23.); if indexc(z,'.') > 0 then z2 = length(left(scan(z,2,'.'))); else z2 = 0; run; proc sql; select max(z2) into :maxdec from test; quit;

On 10/24/07, Raj <ramesh.chakri@gmail.com> wrote: > HI, > > Say there is a dataset like below, how to find the maximum num of > decimal places that variable T has in this dataset and store it into a > macro variable > > In this case the maximum decimals is 2. Any solutions team..? > > data xxxtest; > input t ; > datalines; > 1 > 2.2 > 3.33 > 2.0 > 4 > ; > run; >


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