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 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Sep 2009 12:41:15 -0700
Reply-To:     "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject:      Re: Precision problem
Comments: To: "dc353@hotmail.com" <dc353@HOTMAIL.COM>
In-Reply-To:  A<8cb8f5e5-9205-4682-8663-d1904c181788@j9g2000vbp.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"

Hi,

You could also use the PUTN function. It seems to do well to cosmetically handle precision errors as long as the number of digits in the mantissa is not over 8. e.g. 10.8 25.8 4. etc.

%let sum2=1.0001;

%let obs_cnt=%sysevalf((&sum2-1)*100000); %put obs_cnt is >&obs_cnt<;

%let obs_cnt=%sysfunc(putn(%sysevalf((&sum2-1)*100000),4.2)); %put obs_cnt is >&obs_cnt<;

%let obs_cnt=%sysfunc(putn(%sysevalf((&sum2-1)*100000),25.8)); %put obs_cnt is >&obs_cnt<;

%let obs_cnt=%sysfunc(putn(%sysevalf((&sum2-1)*100000),4.)); %put obs_cnt is >&obs_cnt<;

Hope this is helpful.

Mark Terjeson Investment Business Intelligence Investment Management & Research Russell Investments 253-439-2367

Russell Global Leaders in Multi-Manager Investing

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of dc353@hotmail.com Sent: Tuesday, September 15, 2009 12:03 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Precision problem

I'm submitting the following line:

%let obs_cnt = %sysevalf((&sum2-1)*100000) ;

where &sum2 = 1.0001

I get back &obs_cnt = 9.999999999

i tried to use the int function %let obs_cnt = %sysevalf(int(.5+ (&sum2-1)*100000)) ; but that won't run. is there an easy way to get this to work out to 10?


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