********************************************************; * The book Non-Life Insurance Pricing with GLMs ; * SAS pgm moppe.sas - code for the moped in Example 1.3 ; * No functionality guaranteed - use at your own risk! ; ********************************************************; * Create a libref (change path to your own) ; libname moppe '\My Documents\NonLifeGLM\moppe'; ******************************************; * Entering the data ; ******************************************; data tab1; input premiekl $ moptva $ zon $ dur medskad antskad riskpre helpre cell ; skadfre=antskad/dur; format skadfre percent6.2; drop cell; cards; 1 1 1 62.9 18256 17 4936 2049 1 1 1 2 112.9 13632 7 845 1230 2 1 1 3 133.1 20877 9 1411 762 3 1 1 4 376.6 13045 7 242 396 4 1 1 5 9.4 0 0 0 990 5 1 1 6 70.8 15000 1 212 594 6 1 1 7 4.4 8018 1 1829 396 7 1 2 1 352.1 8232 52 1216 1229 8 1 2 2 840.1 7418 69 609 738 9 1 2 3 1378.3 7318 75 398 457 10 1 2 4 5505.3 6922 136 171 238 11 1 2 5 114.1 11131 2 195 594 12 1 2 6 810.9 5970 14 103 356 13 1 2 7 62.3 6500 1 104 238 14 2 1 1 191.6 7754 43 1740 1024 15 2 1 2 237.3 6933 34 993 615 16 2 1 3 162.4 4402 11 298 381 17 2 1 4 446.5 8214 8 147 198 18 2 1 5 13.2 0 0 0 495 19 2 1 6 82.8 5830 3 211 297 20 2 1 7 14.5 0 0 0 198 21 2 2 1 844.8 4728 94 526 614 22 2 2 2 1296.0 4252 99 325 369 23 2 2 3 1214.9 4212 37 128 229 24 2 2 4 3740.7 3846 56 58 119 25 2 2 5 109.4 3925 4 144 297 26 2 2 6 404.7 5280 5 65 178 27 2 2 7 66.3 7795 1 118 119 28 ; run; * Note: Check the result in SAS:Explorer ; ******************************************; * Define a base cell for Proc GenMod ; ******************************************; data tab1; set tab1; if premiekl='1' then premiekl='BAS'; if moptva='2' then moptva='BAS'; if zon='4' then zon='BAS'; format antskad 4.0 helpre 6.0 riskpre 6.0; run; ******************************************; * Use MMT on the pure premium ; * i.e. Poisson w/log-link ; ******************************************; *ods select none; *Use this line to ge rid of output; proc genmod data=tab1 order=formatted; class premiekl moptva zon; model riskpre = premiekl moptva zon / dist=poisson link=log pscale; ods output ParameterEstimates=jung; weight dur; title 'Pure premium with MMT'; run; ods select all; ******************************************; * Find price relativities by exp() ; ******************************************; data estim (keep= parameter level1 rel); set jung; if Parameter='premiekl' and level1='BAS' then level1='1'; if Parameter='moptva' and level1='BAS' then level1='2'; if Parameter='zon' and level1='BAS' then level1='4'; if parameter='Intercept' or parameter='Scale' then delete; rel = exp(estimate); format rel 7.2; run; proc sort data=estim; by parameter level1; proc print noobs; title 'Pure premium with MMT'; ***** THE END ;;;;;