Hello Rick, Thanks for the help. I tried to fix it , however it runs without error but there is no answer because it never converges. Data sim; Input A B C Beta; cards; 1 2 7 0.5 1 2.5 9 0.5 1 2.5 8 0.5 1 3 9 0.5 ; Run; proc iml; use sim; read all var _NUM_ into DM; close; A = DM[,1]; B = DM[,2]; C = DM[,3]; Beta = DM[,4]; n = nrow(DM); start Func(x); do i = 1 to nrow(DM); return( exp(-x)*exp(2-x +Beta*C)#(cdf("Normal", x-2+Beta*C)-cdf("Normal", x-1+C))); end; finish; answer = j(nrow(DM),1); do i = 1 to nrow(DM); call quad(result, "Func", A || B,); answer = result; end; create kaplan1n var{A B C Beta Answer }; append; quit; LOG FILE 417 Data sim; 418 Input A B C Beta; 419 cards; NOTE: The data set WORK.SIM has 4 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.06 seconds cpu time 0.00 seconds 424 ; 425 Run; 426 proc iml; NOTE: IML Ready 427 use sim; 428 read all var _NUM_ into DM; 429 close; NOTE: Closing WORK.SIM 430 A = DM[,1]; 430! B = DM[,2]; 430! C = DM[,3]; 430! Beta = DM[,4]; 431 n = nrow(DM); 432 433 start Func(x); 434 do i = 1 to nrow(DM); 435 return( exp(-x)*exp(2-x +Beta*C)#(cdf("Normal", x-2+Beta*C)-cdf("Normal", 435! x-1+C))); 436 end; 437 finish; NOTE: Module FUNC defined. 438 answer = j(nrow(DM),1); 439 do i = 1 to nrow(DM); 440 call quad(result, "Func", A || B,); 441 answer = result; 442 end; Convergence could not be attained over the subinterval (1 , 2 ) The function might have one of the following: 1) A slowly convergent or a divergent integral. 2) Strong oscillations. 3) A small scale in the integrand: in this case you can change the independent variable in the integrand, or, provide the optional vector describing roughly the mean and the standard deviation of the integrand 4) Points of discontinuities in the interior in this case, you can provide a vector containing the points of discontinuity and try again. Convergence could not be attained over the subinterval (1 , 2.5 ) The function might have one of the following: 1) A slowly convergent or a divergent integral. 2) Strong oscillations. 3) A small scale in the integrand: in this case you can change the independent variable in the integrand, or, provide the optional vector describing roughly the mean and the standard deviation of the integrand 4) Points of discontinuities in the interior in this case, you can provide a vector containing the points of discontinuity and try again. Convergence could not be attained over the subinterval (1 , 2.5 ) The function might have one of the following: 1) A slowly convergent or a divergent integral. 2) Strong oscillations. 3) A small scale in the integrand: in this case you can change the independent variable in the integrand, or, provide the optional vector describing roughly the mean and the standard deviation of the integrand 4) Points of discontinuities in the interior in this case, you can provide a vector containing the points of discontinuity and try again. Convergence could not be attained over the subinterval (1 , 3 ) The function might have one of the following: 1) A slowly convergent or a divergent integral. 2) Strong oscillations. 3) A small scale in the integrand: in this case you can change the independent variable in the integrand, or, provide the optional vector describing roughly the mean and the standard deviation of the integrand 4) Points of discontinuities in the interior in this case, you can provide a vector containing the points of discontinuity and try again. 443 create kaplan1n var{A B C Beta Answer }; 444 append; 445 quit; NOTE: Exiting IML. NOTE: The data set WORK.KAPLAN1N has 4 observations and 5 variables. NOTE: PROCEDURE IML used (Total process time): real time 0.15 seconds cpu time 0.11 seconds
... View more