Here is a simple example of Monte Carlo method for integration(CDF of normal distribution).
735 %let c1=-1;
736 %let c2=2;
737 %let n=1000;
738 %let seed=561;
739
740 data _null_;
741 do i=1 to &n;
742 x=&c1+(&c2-&c1)* ranuni(&seed);
743 p_mc+ ((&c2-&c1) / &n)*pdf('normal',x);
744 end;
745 p_normal=cdf('normal',&c2) - cdf('normal',&c1);
746 put p_mc= p_normal=;
747 run;
p_mc=0.8100179496 p_normal=0.8185946141
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds