BookmarkSubscribeRSS Feed
Hanyu
Fluorite | Level 6

I have a problem of computing numerical derivative using finite difference method. Obviously, I have to concern two problems, the rounding error and truncation error. The truncation error can be dealt by extrapolation. But the rounding error problem has something to do with machine accuracy and finding the proper scale of perturbation. This probably related to the fundamental of SAS, ie. how the number is stored in SAS and how SAS executes C language. I have already read numerical recipes in C. But I don't know how to apply the method to SAS. Any comment is truly appreciated. Thank you in advance.

3 REPLIES 3
Reeza
Super User

Borrowing a response from

It is an Intel issue not microsoft or SAS or any other program. There is even an IEE-standard.

IEEE floating point - Wikipedia, the free encyclopedia

floating point double-precision is what Intel is using as standard at the moment. Precision is 15 digits.

SAS(R) 9.2 Companion for Windows, Second Edition

Welcome in the digital age and the caveats.

"There are 10 types of people in the world; those that understand BINARY and those that do not"..  

Hanyu
Fluorite | Level 6

Thanks Reeza. Now I want to follow the book Numerical Recipe in C to reduce the round off error. In its 3rd edition page 230, it says one needs to use the trick temp=x+h

        donothing(temp)

     h=temp-x

to achieve the exact h. Any idea how to apply this trick in SAS?

Rick_SAS
SAS Super FREQ

To understand more about floating-point arithmetic, see the paper "What Every Computer Scientist Should Know About Floating-Point Arithmetic."

If you are doing numerical analysis in SAS, you should look at the SAS/IML language. The SAS/IML language supports numerical integration, differentiation, optimization, matrix computations, and other operations covered in Numerical Recipes. There is even a separate SAS/IML Support Community for questions about numerical operations.

Here are a few blog posts about numerical differentiation (also call finite differencing):

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1836 views
  • 0 likes
  • 3 in conversation