我正在运行以下代码。但是,我得到的是以下错误:
matrix z has not been set to a value
我试图重置“call quad(z,”fun“,ylow || yhigh)peak = mid”by“call quad(z,”fun“,ylow || yhigh,peak = mid)”,但是仍然有同样的问题。任何人都可以就此问题向我提出建议。我认为主要的问题是z变量(区间ylow || yhigh上的“FUN”的积分没有赋值),但是我没有识别错误
%macro loop;
DATA test;
SET sample1;
IF ext_opt = 0 THEN ext_opt = .0001;
ylow = LOG(debt_face);
KEEP csho t_debt va siga debt_face exp_rf rf_net exp_divex exp_rfex x lambda ext_opt ylow;
RUN;
DATA test;
RETAIN csho t_debt va siga debt_face exp_rf rf_net exp_divex exp_rfex x lambda ext_opt ylow;
SET test;
KEEP csho t_debt va siga debt_face exp_rf rf_net exp_divex exp_rfex x lambda ext_opt ylow;
RUN;
* Read data into IML ;
PROC IML;
USE test;
READ all var _ALL_ into B;
CLOSE close test;
csho = B[1,1];
t_debt = B[1,2];
va = B[1,3];
siga = B[1,4];
debt_face = B[1,5];
exp_rf = B[1,6];
rf_net = B[1,7];
exp_divex= B[1,8];
exp_rfex = B[1,9];
x = B[1,10];
lambda = B[1,11];
ext_opt = B[1,12];
ylow = B[1,13];
START FUN(y) GLOBAL (va, rf_net, siga, t_debt, debt_face, csho, x, exp_divex, exp_rf, exp_rfex, lambda, ext_opt, vd, ylow);
IF ext_opt = 0 THEN ext_opt = .0001;
f1d = (y - LOG((debt_face + csho * x)) + (rf_net + 0.5 * siga**2) * ext_opt) / (siga * SQRT(ext_opt));
f2d = f1d - (siga * SQRT(ext_opt)) ;
opt = (EXP(y) * exp_divex * PROBNORM(f1d) - (debt_face + csho * x) * exp_rfex * PROBNORM(f2d)) ;
mu = LOG(va) + (rf_net - 0.5 * siga**2) * t_debt;
sigma = siga * SQRT(t_debt);
a0 = (LOG(debt_face + csho * x) -mu) / sigma;
pdf = EXP(-((y - mu)**2/(2 * sigma**2))) / (SQRT (2 * CONSTANT('PI')) * sigma);
pre = lambda * exp_rf;
int = pre * opt* pdf;
return(int);
finish;
mu = LOG(va) + (rf_net - 0.5 * siga**2) * t_debt;
sigma = siga * SQRT(t_debt);
yhigh = mu + 5 * sigma;
mid = (yhigh + ylow) / 2;
call quad(z, "fun", ylow || yhigh) peak= mid;
create MyData2 from z;
append from z;
close MyData2;
quit ;
%mend loop;
我包含了数据集的示例:
co_per_rol gvkey year sich prcc_f csho optosey optprcey dlc dltt ap fyr lt datadate mve xint debt t_debt interest max_interest no_debt_mat t_opt x_camp execid shrown_excl_opts opt_unex_unexer_num opt_unex_exer_num inside_debt ceo_opt ex2ex ex2un ceo_ex t_debt_round compdate r_debt r_opt sige divyield v_eq est_v_eq sig_eq va siga debt_face debt_contract divrate_crsp div_rate exp_div exp_rf rf_net exp_divex exp_rfex q lambda war_adj x opt_prc_stk ext_opt lev agg_x
5623 001004 2006 5080 32.5 37.729 2.135 18.3 74.245 253.611 110.239 5 573.39 17317 1226.1925 17.678 327.856 5.009200076 0.052516559 0.139761942 0.51 7 327.856 09249 868.993 0 0.881183 4402.5 0.881183 20.25484207 32.5 20.25484207 5 2007.05 0.046406372 0.046501835 0.183044016 1226.1925 1226.1925 0.183044016 1554.0485 0.14442741 426.5119726 327.856 0.7925824 0.911753325 0.056587771 0.02508529 0.053557094 18.3 1.775956284 1.990799924 0.210968963 1116.952673
5623 001004 2007 5080 19.28 38.773 1.425 21.53 22.994 507.918 99.073 5 776.755 17683 747.54344 21.95 530.912 6.053130839 0.04372976 0.139761942 0.51 7 530.912 09249 853.306 0 0.523742 5223.276 0.523742 18.47186164 19.28 18.47186164 6 2008.05 0.04372976 0.044112578 0.155362412 747.54344 747.54344 0.155362412 1278.45544 0.090844114 691.8009291 530.912 0.767434644 0.959439172 0.036752379 0.02487686 0.035449525 21.53 0.895494659 0.946869161 0.415276108 1526.583619
5623 001004 2008 5080 14.7 38.884 1.225 21.18 63.6 392.984 100.651 5 720.616 18048 571.5948 18.371 456.584 5.506016856 0.039447371 0.139761942 0.51 7 456.584 09249 907.12 0 0.328742 5125.968 0.328742 14.7 14.7 14.7 6 2009.05 0.02946171 0.031207927 0.135189742 571.5948 571.5948 0.135189742 1028.1788 0.075155949 567.3466999 456.584 0.850256959 0.956939318 0.03150396 0.02493206 0.030541774 21.18 0.694050992 1.493983144 0.444070623 1390.90982
5623 001004 2009 5080 19.7 39.484 1.543 19.28 100.833 336.191 114.906 5 754.692 18413 777.8348 26.832 437.024 4.984859184 0.059586046 0.139761942 0.51 7 437.024 09249 1082.476 0.2 0.328742 6248.522 0.528742 18.21769777 15.1 17.0384089 5 2010.05 0.021761492 0.027809699 0.122556731 777.8348 777.8348 0.122556731 1214.8588 0.078469111 588.1700818 437.024 0.897198658 0.957095147 0.039079121 0.024374193 0.037609379 19.28 1.021784232 2.015140816 0.359732341 1349.421602
5623 001004 2010 5080 26.39 39.781 1.994 18.56 114.075 329.802 185.096 5 868.438 18778 1049.82059 30.67 443.877 4.835117837 0.066813168 0.139761942 0.51 7 443.877 09249 1175.638 0.217497 0.335809 8080.238 0.553306 18.27720076 15.93970873 17.3583647 5 2011.05 0.019116116 0.025862658 0.127011955 0.037893143 1049.82059 1049.82059 0.127011955 1493.69759 0.089268247 613.1422939 443.877 0.037192834 0.026284094 0.880657324 0.911714238 -0.007167978 0.944686676 0.959460493 0.050124431 0.023937762 0.047731897 18.56 1.421875 2.164882163 0.297166577 1351.477654
5623 001004 2011 5080 12.05 40.273 1.703 17.96 122.865 669.489 201.405 5 1329.631 19144 485.28965 37.772 792.354 5.416139377 0.046569235 0.139761942 0.51 7 792.354 09249 1193.963 0.161995 0.323665 8697.998 0.48566 12.05 12.05 12.05 5 2012.05 0.015085638 0.021370026 0.127695024 0.082987554 485.28965 485.28965 0.127695024 1277.64365 0.048502627 1019.669392 792.354 0.079723476 0.031034712 0.84527917 0.92154293 -0.015949075 0.952033878 0.976389643 0.042286395 0.023823137 0.040570802 17.96 0.670935412 1.583860623 0.620168229 1742.972472
5623 001004 2012 5080 20.06 39.382 2.3 16.22 86.4 622.2 149.3 5 1217.4 19509 790.00292 41.6 708.6 5.604995766 0.057048645 0.139761942 0.51 7 708.6 09249 1151.153 0.201469 0.303323 11340.288 0.504792 16.08324914 14.55387747 15.47285718 6 2013.05 0.009851316 0.01212618 0.138980344 0.049850449 790.00292 790.00292 0.138980344 1498.60292 0.073264823 975.59604 708.6 0.048647724 0.025939779 0.864682968 0.946280176 -0.016088463 0.964460789 0.986351371 0.058402316 0.023991171 0.055179694 16.22 1.23674476 1.395004234 0.472840397 1614.37208
5623 001004 2013 5080 24.3 39.56 2.753 19.59 69.7 564.3 171.1 5 1198.8 19874 961.308 42 634 5.673359621 0.064144122 0.139761942 0.51 7 634 09249 1362.684 0.29321 0.342375 13935.638 0.635585 16.23870464 19.82102589 17.89131194 6 2014.05 0.014395881 0.017250354 0.131536007 0.041152265 961.308 961.308 0.131536007 1595.308 0.079261569 912.2933772 634 0.040328047 0.024495247 0.870253835 0.921573256 -0.010099366 0.96802595 0.981083058 0.069590495 0.023633399 0.065062747 19.59 1.24042879 1.326640379 0.397415421 1687.273777
5623 001004 2014 5080 29.54 35.423 1.857 21.05 69 85 142.3 5 669.9 20239 1046.39542 26.5 154 3.746103896 0.139761942 0.139761942 0.51 7 154 09249 1375.456 0.222926 0.070896 15959.709 0.293822 27.70343658 20.75450616 22.43120624 4 2015.05 0.012620031 0.021174236 0.118264049 0.033852402 1046.39542 1046.39542 0.118264049 1200.39542 0.103091829 259.9567729 154 0.033292021 0.029082418 0.896779056 0.953824155 -0.016462387 0.909708402 0.959767443 0.052423567 0.026824034 0.049812232 21.05 1.403325416 3.253896104 0.128291059 1005.610923
8741 001013 2006 3661 14.31 117.2 6.6 29.08 0 400 88.4 10 737.9 17105 1677.132 15.8 400 6.3 0.046501835 0.139761942 0.51 7 400 10203 1379.178 0.232143 0.482219 0.714362 14.31 14.31 14.31 6 2006.1 0.046501835 0.046501835 0.163688943 1677.132 1677.132 0.163688943 2077.132 0.132166836 536.1565052 400 0.746050819 0.967972807 0.056313993 0.008077544 0.053311793 29.08 0.492090784 0.7 0.192573221 3944.332505
8741 001013 2007 3661 18.7 117.6 6.7 25.46 200.6 200.6 92.5 10 757.2 17470 2199.12 16.3 401.2 3.45 0.042580446 0.139761942 0.51 7 401.2 10203 137.71 0.305179 0.538966 561.806 0.844145 17.78154874 16.81454917 17.43195482 3 2007.1 0.042580446 0.044112578 0.144926861 2199.12 2199.12 0.144926861 2600.32 0.122566284 464.6863194 401.2 0.863378118 0.859709632 0.056972789 0.008045052 0.05390185 25.46 0.734485467 3.55 0.154288703 3458.782319
8741 001013 2008 3661 6.34 111.3 6.8 23.64 2.6 650.7 99.1 10 1006.8 17836 705.642 28.2 653.3 6.277315169 0.042259809 0.139761942 0.51 7 653.3 10203 211.589 0.343215 0.617788 669.957 0.961003 6.34 6.34 6.34 6 2008.1 0.02946171 0.031207927 0.130162597 705.642 705.642 0.130162597 1358.942 0.067588017 851.768336 653.3 0.831153788 0.978933534 0.061096137 0.008467401 0.057578323 23.64 0.268189509 0.722684831 0.480741636 3482.900336
8741 001013 2009 3661 8.34 96.6 7.8 19.4 0.6 651 83 9 987.4 18170 805.644 25.8 651.6 6.294751381 0.038831064 0.139761942 0.51 7 651.6 10203 482.333 0.63225 0.733325 800.985 1.365575 8.34 5.988493476 7.251271809 6 2009.09 0.024790169 0.027809699 0.174764022 805.644 805.644 0.174764022 1457.244 0.096619088 832.0252329 651.6 0.855518167 0.982668712 0.080745342 0.009578544 0.074712644 19.4 0.429896907 0.705248619 0.447145433 2706.065233
8741 001013 2010 3661 12.67 97.2 7.5 15.91 0.3 650.8 97.2 9 1040.1 18535 1231.524 27.4 651.1 6.297373675 0.041221239 0.139761942 0.51 7 651.1 10203 0 0.634143 0.914587 860.366 1.54873 11.75939226 6.524999582 9.616117787 6 2010.09 0.022446189 0.025862658 0.191845641 1231.524 1231.524 0.191845641 1882.624 0.125496387 844.0812737 651.1 0.868183621 0.984352432 0.077160494 0.009551098 0.071633238 15.91 0.796354494 0.702626325 0.345847073 2390.533274
33287 001034 2006 2834 24.1 43.099 1.344 24.77 0 0 50.18 12 203.24 17166 1038.6859 2.875 0 0.51 0.048218574 0.139761942 0.51 7 0.019141081 31853 40 0.1 0 0 0.1 24.1 23.73 23.73 1 2006.12 0.048218574 0.046501835 0.192060471 0.041493777 1038.6859 1038.6859 0.192060471 1038.705041 0.192056931 0.019617624 0.019141081 0.040656007 0.040655273 0.979479286 0.975708434 0.007563301 0.768086655 0.731294853 0.031184018 0.022500731 0.030240983 24.77 0.972951151 6.49 1.84278E-05 1067.581848
33287 001034 2007 2834 20.15 43.794 1.389 22.71 11.032 300 57.903 12 557.038 17531 882.4491 6.245 311.032 6.09782659 0.04372976 0.139761942 0.51 7 311.032 31853 91.45 0.1745 0.025 0 0.1995 20.15 20.15 20.15 6 2007.12 0.04372976 0.044112578 0.178045183 882.4491 882.4491 0.178045183 1193.4811 0.131644994 406.0808559 311.032 0.765936132 0.961316263 0.031716674 0.022132218 0.030741651 22.71 0.887274328 0.90217341 0.26060907 1400.642596
14221 001045 2006 4512 30.23 222.224 37.162 15.93 1349 12041 1073 12 29751 17166 6717.83152 1030 13390 5.725743092 0.074107972 0.139761942 0.51 7 13390 14591 0 0.291 0.68732 2656.761 0.97832 24.50286271 15.92513402 21.95142857 6 2006.12 0.046501835 0.046501835 0.271268278 6717.83152 6717.83152 0.271268278 20107.83152 0.090628101 20467.35892 13390 0.76624175 0.942466142 0.167227662 0.003855258 0.143269105 15.93 1.897677338 1.274256908 0.665909697 24007.38724
14221 001045 2007 4512 14.03 249.398 26.121 15.68 1049 10093 1182 12 25914 17531 3499.05394 914 11142 5.763354873 0.07884071 0.139761942 0.51 7 11142 14591 0 0.2608 0.72372 2910.884 0.98452 13.76630686 12.59273006 13.45542559 6 2007.12 0.04372976 0.044112578 0.26067552 3499.05394 3499.05394 0.26067552 14641.05394 0.062298637 17550.9616 11142 0.777221325 0.947358026 0.104736205 0.003629514 0.094806529 15.68 0.894770408 1.236645127 0.761010788 21461.52224
14221 001045 2008 4512 10.67 278.949 27.61594 14.769 1956 9001 952 12 28110 17897 2976.38583 756 10957 5.282458702 0.066720815 0.139761942 0.51 7 10957 14591 173.736 0.4634 0.77394 3082.097 1.23734 10.51087655 9.012693138 9.949787286 5 2008.12 0.027615166 0.031207927 0.191869065 2976.38583 2976.38583 0.191869065 13933.38583 0.040986188 15586.8634 10957 0.864264888 0.953677049 0.098999961 0.003261952 0.09008186 14.769 0.722459205 1.717541298 0.786384597 19706.66118
答案 0 :(得分:1)
当我对样本数据进行小修正(第10行缺少inside_debt的值,因此我将其归为500)时,它无法收敛,并带有以下注释:
Convergence could not be attained over the subinterval
(-450755.2939 , 5.7925744876 )
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.
ERROR: Execution error as noted previously. (rc=100)
这意味着未创建z
,您注意到的错误稍晚:
645 create MyData2 from z;
ERROR: Matrix z has not been set to a value.
由于Z不存在,因此无法输出。