How can integrate this function in SAS. Limit of integration is a and b.
exp(2-x) CDF(X) dx
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.
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;
Apparently this thread is continuing here: https://communities.sas.com/message/229999#229999
⏰
Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.
Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.