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
- /
- Analytics
- /
- Stat Procs
- /
- SAS integration that could not be solved in closed...

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

09-21-2014 06:18 PM

How can integrate this function in SAS. Limit of integration is a and b.

exp(2-x) CDF(X) dx

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

09-22-2014 02:00 PM

Is the CDF of a well-known distribution? If so, you can use the CDF function in SAS as part of the integrand.

To compute a numerical integration with known limits of integration, use the QUAD call in PROC IML. For the standard normal CDF and [a,b] = [0,1], the call would look like this:

start Func(x);

return( exp(2-x)#cdf("Normal", x) );

finish;

interval = {0 1};

call quad(answer, "Func", interval);

print answer;

For more on numerical integration with SAS, I have written several blog posts. You might want to do an internet search for

integrate function site:http://blogs.sas.com/content/iml/

and include other keywords as necessary.

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

09-23-2014 11:48 PM

Hello Rick,

Thank for your help. I am trying to do this numerical integration within a simulation. I used your code and read through the site but I am having one issue in the code below;

Data sim;

Input A B;

cards;

1 3

2 7

3 10

4 12

;

Run;

proc iml;

use sim;

read all var{A B} into DM;

close;

A = DM[,1]; B = DM[,2];

n = nrow(DM);

start Func(x);

return( exp(2-x)#cdf("Normal", x) );

finish;

interval = {A, B};

call quad(answer, "Func", interval);

create kaplan1n var{A B Answer };

append;

quit;

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

09-24-2014 10:32 AM

Apparently this thread is continuing here: https://communities.sas.com/message/229999#229999