Date: Tue, 15 Sep 2009 12:36:33 -0700
Reply-To: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject: Re: Precision problem
In-Reply-To: <ce1fb7450909151226p50de7be4nfc252f2357520833@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Data _null_;
> Sent: Tuesday, September 15, 2009 12:26 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Precision problem
>
> 1436 %let sum2 = 1.0001;
> 1437 %let obs_cnt = %sysevalf((&sum2-1)*100000,CEIL);
> 1438 %put &Obs_cnt;
> 10
>
> On 9/15/09, dc353@hotmail.com <dc353@hotmail.com> wrote:
> > 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?
> >
If you want to "round" your result you almost had it with your use of the int function, but you need to use %sysfunc with it.
%let n=%sysfunc(int(%sysevalf(.5+(1.0001-1)*100000)));
%put n=&n ;
Hope this is helpful,
Dan
Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
|