libname sag2006 'c:\data\MRFSS\sag2006'; data temp2006; set sag2006.ncshorerum; widthsq = width*width; if site = 15 or site = 20 or site = 29 or site = 30 or site = 43 or site = 46 or site = 48 or site = 50 then catch = 0; sqrtcatch = catch**(.5); proc mdc type = clogit; model y = ttc sqrtcatch width / choice = (site 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50); id id; run; proc mdc type = nlogit outest = betas; model y = ttc sqrtcatch width / samescale choice = (site 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50); id id; utility u(1, ) = ttc sqrtcatch width; nest level(1) = (1 2 3 4 7 10 13 14 15 16 17 19 20 22 @ 1, 5 6 8 9 11 12 18 21 @ 2, 26 27 28 31 32 35 42 43 50 @ 3, 23 24 25 29 30 33 34 36 37 38 39 40 41 44 45 46 47 48 49 @ 4), level(2) = (1 2 3 4 @ 1); run; data beta2; set betas; mergevar = 1; data cs; set sag2006.cs_shore; mergevar = 1; data utility; merge beta2 cs; by mergevar; array tc{50} tc1-tc50; array catchx{50} catch1-catch50; ARRAY w05{50} w_05_1-w_05_50; ARRAY w30{50} w_30_1-w_30_50; ARRAY w80{50} w_80_1-w_80_50; array util05{50} u05_1-u05_50; array util30{50} u30_1-u30_50; array util80{50} u80_1-u80_50; do i = 1 to 50; if w30{i} < 0 then w30{i} = 0; if w80{i} < 0 then w80{i} = 0; end; do i=1 to 50; util05{i}=exp(((tc{i}*ttc_L1)+((catchx{i})**(.5)*sqrtcatch_L1)+(w05{i}*width_L1))/INC_L2G1); util30{i}=exp(((tc{i}*ttc_L1)+((catchx{i})**(.5)*sqrtcatch_L1)+(w30{i}*width_L1))/INC_L2G1); util80{i}=exp(((tc{i}*ttc_L1)+((catchx{i})**(.5)*sqrtcatch_L1)+(w80{i}*width_L1))/INC_L2G1); end; /* sum over all sites */ sum2006 = sum(u05_1,u05_2,u05_3,u05_4,u05_5,u05_6,u05_7,u05_8,u05_9,u05_10, u05_11,u05_12,u05_13,u05_14,u05_15,u05_16,u05_17,u05_18,u05_19,u05_20, u05_21,u05_22,u05_23,u05_24,u05_25,u05_26,u05_27,u05_28,u05_29,u05_30, u05_31,u05_32,u05_33,u05_34,u05_35,u05_36,u05_37,u05_38,u05_39,u05_40, u05_41,u05_42,u05_43,u05_44,u05_45,u05_46,u05_47,u05_48,u05_49,u05_50)**INC_L2G1; sum2030 = sum(u30_1,u30_2,u30_3,u30_4,u30_5,u30_6,u30_7,u30_8,u30_9,u30_10, u30_11,u30_12,u30_13,u30_14,u30_15,u30_16,u30_17,u30_18,u30_19,u30_20, u30_21,u30_22, u30_24,u30_25,u30_26,u30_27,u30_28,u30_29,u30_30, u30_31,u30_32,u30_33,u30_34,u30_35,u30_36,u30_37,u30_38,u30_39,u30_40, u30_41,u30_42,u30_43,u30_44,u30_45,u30_46,u30_47,u30_48,u30_49 )**INC_L2G1; sum2080 = sum(u80_1,u80_2,u80_3,u80_4,u80_5,u80_6,u80_7,u80_8,u80_9,u80_10, u80_11,u80_12,u80_13,u80_14,u80_15,u80_16,u80_17,u80_18,u80_19,u80_20, u80_21,u80_22, u80_24,u80_25,u80_26,u80_27,u80_28, u80_30, u80_31,u80_32,u80_33,u80_34,u80_35,u80_36,u80_37,u80_38,u80_39,u80_40, u80_41,u80_42,u80_43,u80_44,u80_45,u80_46,u80_47,u80_48,u80_49 )**INC_L2G1; emaxu2006 = log(sum2006); emaxu2030 = log(sum2030); emaxu2080 = log(sum2080); WTP2030 =(emaxu2006-emaxu2030)/(-ttc_L1); if wtp2030 lt 0 then wtp2030 = 0; WTP2080 =(emaxu2006-emaxu2080)/(-ttc_L1); proc means; var emaxu2006 emaxu2030 emaxu2080 wtp2030 wtp2080; run; /* demand model */ data genmod; set utility; proc genmod data = genmod; model ffdays12 = emaxu2006 / dist = nb; output out=negbin pred=pdays12 xbeta=xb; run; data negbin2; set negbin; pdays12x = exp(xb-.3792*(emaxu2006-emaxu2030)); pdays12y = exp(xb-.3792*(emaxu2006-emaxu2080)); diff30 = pdays12 - pdays12x; diff80 = pdays12x - pdays12y; run; proc means; var ffdays12 pdays12 pdays12x pdays12y diff30 diff80; run;