turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- compute numerical derivative

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2014 10:01 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-24-2014 11:27 AM

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"..

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-25-2014 08:52 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-03-2014 11:34 AM

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):

- The DIF function: Compute lagged differences and finite differences - The DO Loop
- The NLPFDD subroutine in SAS/IML performs forward or central finite differencing. See Optimizing? Two hints for specifying derivatives - The DO Loop