HEA_03.21.11.txt

Author: Abt Associates Inc.

Created: 12/16/09

Updated: 3/22/11

Purpose: This file is a SAS program which calculates the non-use benefits of

regulatory options using a habitat-based approach;

*Benefits are reported in $1,000.

*The location of the input and output files is here;

%let d=h; *(C or H drive);

%let mainloc=&d.:\ERD\TYCHE Contract\Assignments\WA 2-15 (316b Benefits & SP

Study)\Task 5 - Benefits Analytic Support\IE_032111\HEA\;

%let inloc=&mainloc.Inputs\;

%let outloc=&mainloc.Outputs\;

libname outloc "&outloc";

*assumptions;

%let t0=2012; *(define when time zero is);

%let yrba=2012; *(based year for discounting-set equal to t0);

%let yrsc=50; *(define the annualization period);

%let af_3=(0.03*(1.03**50))/((1.03**50)-1); *(define the 3% annualization

factor by changing the number of compliance years);

%let af_7=(0.07*(1.07**50))/((1.07**50)-1); *(define the 7% annualization

factor by changing the number of compliance years);

%let ie_year=2018; *(define the first year of I&E for compliance, all year

prior just impingement only);

*The name of the input file is;

%let input=HEA_Inputs_03.21.11.xls;

%let input2=IE_outputs_22MAR11.xls;

*The name of the output files are;

%let output=HEABenOutputs_&sysdate..xls;

%let tables=HEABenTables_&sysdate..xls;

%let SumTables=HEABenTablesSum_&sysdate..xls;

%let printout=&outloc.HEA Ben Tables &sysdate..rtf;

%let printout3=&outloc.HEA Ben Tables &sysdate..csv;

*This is a macro that can be used to import data from excel;

%macro import(infile,insheet,out);

PROC IMPORT OUT= WORK.&out

DATAFILE= "&infile"

DBMS=EXCEL REPLACE;

SHEET="&insheet.$";

GETNAMES=YES;

MIXED=NO;

SCANTEXT=YES;

USEDATE=YES;

SCANTIME=YES;

RUN;

%mend;

*This is a macro that can be used to export data to excel;

%macro export(datafile,outfile,sheet);

PROC EXPORT DATA= &datafile

OUTFILE= &outfile

DBMS=EXCEL replace;

SHEET=&sheet;

RUN;

%mend;

*import data sets from excel input file;

*import primary production data (prim.prod);

Page 1
HEA_03.21.11.txt

%import(&inloc.&input,prim_prod,prim_prod);

*import restoration cost data;

%import(&inloc.&input,rest_costs,rest_costs);

*import WTP data;

%import(&inloc.&input,WTP,WTP);

*import HH data;

%import(&inloc.&input,HH_data,HH_data);

*import flow data;

%import(&inloc.&input,flow_data,flow_data);

**************************************************************************

*import I&E data;

%import(&inloc.&input2,BNB_IE,ie);

*import impingement data;

%import(&inloc.&input2,BNB_IMP,i_only);

*import entrainment data;

%import(&inloc.&input2,BNB_ENT,ent_only);

*import the worksheet with the ccr.fraction data;

%import(&inloc.&input2,REDUCTIONS_DETAIL,reductions_detail);

**************************************************************************

THIS SECTION REORGANIZES THE DATA IN ORDER TO CALCULATE THE TOTAL "IMPINGEMENT

FRACTION" for I&E;

DATA reductions_detail;

SET reductions_detail;

if region="" then delete;

RUN;

PROC SORT data=reductions_detail;

By option_name region;

RUN;

Data i_only_1;

set i_only;

DO imp_benefit_value_regional=benefit_value_regional;

END;

IF species_econ~="zz.all.species" then delete;

IF metric~="ae1" then delete;

if comrec_type~="all.types" then delete;

IF region="zz.allregions" then delete;

DROP lossmode baseline_value_regional benefit_value_regional;

RUN;

PROC SORT data=i_only_1;

By option_name region value_basis species_econ metric comrec_type;

RUN;

Data ent_only_1;

set ent_only;

DO ent_benefit_value_regional=benefit_value_regional;

END;

IF species_econ~="zz.all.species" then delete;

IF metric~="ae1" then delete;

if comrec_type~="all.types" then delete;

IF region="zz.allregions" then delete;

DROP lossmode baseline_value_regional benefit_value_regional;

RUN;

PROC SORT data=ent_only_1;

by option_name region value_basis species_econ metric comrec_type;

RUN;

Data ie_rd1;

set ie;

DO ie_benefit_value_regional=benefit_value_regional;

END;

IF species_econ~="zz.all.species" then delete;

IF metric~="ae1" then delete;

if comrec_type~="all.types" then delete;

IF region="zz.allregions" then delete;

Page 2
HEA_03.21.11.txt

if region="zz.allregions" then delete;

RUN;

PROC SORT data=ie_rd1;

by option_name region value_basis species_econ metric comrec_type;

RUN;

DATA ie_rd2;

merge ie_rd1 i_only_1 ent_only_1;

by option_name region value_basis species_econ metric comrec_type;

RUN;

Data ie_rd3;

merge ie_rd2 reductions_detail;

by option_name region;

IF ent_benefit_value_regional="." then do ent_benefit_value_regional=0;

END;

IF imp_benefit_value_regional="." then do imp_benefit_value_regional=0;

END;

imp_frac_imp=(1-ccr_fraction_imp);

IF ie_benefit_value_regional=0 then do impingement_fraction="";

END;

IF ie_benefit_value_regional~=0 then do

impingement_fraction=(imp_frac_imp*(imp_benefit_value_regional))/ie_benefit_value_re

gional;

END;

DROP ie_benefit_value_regional imp_benefit_value_regional

ent_benefit_value_regional ccr_fraction_imp imp_frac_imp

value_basis species_econ lossmode metric comrec_type baseline_value_regional

benefit_value_regional;

RUN;

Proc Sort data=ie out=ie;

by option_name region;

RUN;

PROC Sort data=ie_rd3 out=ie_rd3;

by option_name region;

RUN;

Data ie;

merge ie ie_rd3;

by option_name region;

RUN;

*****************************************************************

PRODUCTIVITY CALCULATIONS

*calculate total primary productivity and secondary productivity per acre;

*primary productivity is the sum of aboveground productivity (abv_prim_prod) and

algal productivity (alg_prim_prod);

*tc_ represent the trophic conversion efficiencies required to convert primary

productivity to secondary productivity;

*C_export is the fraction of productivity which is lost from the system, and

therefore not converted to higher trophic levels;

*Values for these variables are specified in the excel input workbook;

DATA prim_prod_1;

SET prim_prod;

DO prim_prod_acre=abv_prim_prod+alg_prim_prod;

END;

DO sec_prod_acre=(prim_prod_acre)*tc_det*(1-C_export)*tc_1st*tc_2nd;

END;

Run;

*this step manipulates the I&E input data set ("ie")

restoration is scaled under the HEA method based on the weight of age 1

equivalents (ael.lbs)

Page 3
HEA_03.21.11.txt

In the inputs dataset ae1.lbs is expressed in terms of lbs of wet weight,

this must be converted to kg of dry weight

0.22 is the ratio of dry weight to wet weight

2.20462262 is the number of lbs per kg;

Data ie_1;

SET ie (KEEP = option_name region metric comrec_type species_econ

benefit_value_regional baseline_value_regional);

IF metric="ae1.lbs";

IF comrec_type="all.types";

IF species_econ="zz.all.species";

IF region~="zz.allregions";

*convert reductions to kg dw;

DO ben_val_reg=(benefit_value_regional*.22)/2.20462262;

END;

DO bas_val_reg=(baseline_value_regional*.22)/2.20462262;

END;

DROP metric comrec_type species_econ benefit_value_regional

baseline_value_regional;

*Multiple potential restoration types are permitted in the input data set for some

regions

the restoration habitat can be changed to the regional alternative within

the IF statements below (would also have to be changed later in code)

the preferred restoraiton habitat for each region is listed first:

California - kelp (ca_kelp) or typha (ca_typha)

North Atlantic - eelgrass (na_eelgrass) or spartina (na_spartina)

Mid-Atlantic - spartina (ma_spartina) or eelgrass (ma_eelgrass)

South Atlantic - spartina (sa_spartina) or eelgrass (sa_eelgrass)

Gulf of Mexico - spartina (gom_spartina) or turtlegrass

(gom_turtlegrass)

Great Lakes - typha (gl_typha)

Inland - typha (in_typha);

LENGTH rest_id $20;

IF region="calif" THEN DO;

rest_id="ca_kelp";

END;

IF region="northatlantic" THEN DO;

rest_id="na_eelgrass";

END;

IF region="midatlantic" THEN DO;

rest_id="ma_spartina";

END;

IF region="southatlantic" THEN DO;

rest_id="sa_spartina";

END;

IF region="gulfmexico" THEN DO;

rest_id="gom_spartina";

END;

IF region="greatlakes" THEN DO;

rest_id="gl_typha";

END;

IF region="inland" THEN DO;

rest_id="in_typha";

End;

Run;

PROC SORT Data=ie_1;

BY rest_id;

RUN;

Data sec_prod;

SET prim_prod_1 (KEEP= rest_id sec_prod_acre);

RUN;

Page 4
HEA_03.21.11.txt

PROC SORT Data=sec_prod;

BY rest_id;

RUN;

*This data set merges the ie data together with the calculated values for secondary

productivity

per acre of habitat;

DATA ie_2;

Merge ie_1 sec_prod;

BY rest_id;

DO eq_ben_acres= ben_val_reg/sec_prod_acre;

END;

DO eq_bas_acres=bas_val_reg/sec_prod_acre;

END;

IF ben_val_reg="." THEN DELETE;

DROP ben_val_reg bas_val_reg sec_prod_acre;

RUN;

*The following steps incorporate the restoration id into flow data and incorporate

restoration cost and WTP data;

*rest_id would need to be changed within each if statement in order to specify

different habitats for each region;

DATA flow_data_1;

SET flow_data;

IF region="calif" THEN DO;

rest_id="ca_kelp";

END;

IF region="northatlantic" THEN DO;

rest_id="na_eelgrass";

END;

IF region="midatlantic" THEN DO;

rest_id="ma_spartina";

END;

IF region="southatlantic" THEN DO;

rest_id="sa_spartina";

END;

IF region="gulfmexico" THEN DO;

rest_id="gom_spartina";

END;

IF region="greatlakes" THEN DO;

rest_id="gl_typha";

END;

IF region="inland" THEN DO;

rest_id="in_typha";

End;

RUN;

PROC SORT Data=flow_data_1;

by rest_id;

RUN;

*wtp contains wtp per HH per acre for habitat/region combinations;

PROC SORT Data=wtp;

by rest_id;

RUN;

PROC SORT Data=rest_costs;

by rest_id;

RUN;

DATA flow_data_2;

Merge flow_data_1 rest_costs wtp;

BY rest_id;

IF frac_AIF="." THEN DELETE;

RUN;

PROC SORT Data=flow_data_2;

by state;

RUN;

PROC SORT DATA=HH_data;

Page 5
HEA_03.21.11.txt

by state;

RUN;

DATA flow_data_3;

Merge flow_data_2 hh_data;

By state;

DROP species fish_prod tot_WTP_HH;

IF frac_AIF="." THEN DELETE;

RUN;

Proc sql;

create table f3_table as

select region,

state,

AIF,

frac_AIF,

rest_id,

cost_acre,

WTP_HH,

numHH,

sum(numHH) as reg_HH

FROM flow_data_3 group by region;

quit;

RUN;

DATA flow_data_4;

SET f3_table;

RUN;

PROC SORT Data=flow_data_4;

by region;

RUN;

PROC SORT Data=ie_2;

by region;

RUN;

PROC TRANSPOSE data=ie_2 out=ie_3;

BY region;

id option_name;

Var eq_ben_acres;

RUN;

PROC TRANSPOSE data=ie_2 out=ie_4;

BY region;

id option_name;

Var eq_bas_acres;

RUN;

DATA ie_5;

SET ie_4 (rename=(option_tmn1=baseline));

DROP option_tmn2 option_tmn3 option_tmn4;

RUN;

DATA ie_6;

MERGE ie_3 ie_5;

By region;

RUN;

DATA flow_data_5;

Merge flow_data_4 ie_6;

by region;

IF frac_AIF="." THEN DELETE;

RUN;

*This data set calculates the annual WTP for each option and baseline for each state

1,000s of dollars.

flow_data_5 provides the total number of habitat acres required for each region, but

acres are not yet broken out by state

option_tmn(i) is the array of the total acres required in each region

frac_AIF is the fraction of regional AIF that facilities in each state account for

frac_tmn(i) is calculated in this step, the actual number of regional habitat acres

Page 6
HEA_03.21.11.txt

assigned to each state;

DATA Annual_Values;

SET flow_data_5;

array frac_tmn(5) frac_tmn1 frac_tmn2 frac_tmn3 frac_tmn4 frac_baseline;

array option_tmn(5) option_tmn1 option_tmn2 option_tmn3 option_tmn4

baseline;

do i=1 to 5;

frac_tmn(i)=frac_AIF*option_tmn(i);

end;

*WTP_HH is the willingness to pay per household per acre within a given region for

the specified habitat type;

array a_WTP_(5) a_WTP_1 a_WTP_2 a_WTP_3 a_WTP_4 a_WTP_bas;

do i=1 to 5;

*a_WTP_(i) is total annual WTP to be within a state (in 1,000s of $), calculated as

the product of willingness

to pay per household per acre, the total number of households statewide, and

the total number of acres assigned to that state;

a_WTP_(i)=(WTP_HH*numHH*frac_tmn(i))/1000;

END;

DROP option_tmn1 option_tmn2 option_tmn3 option_tmn4;

RUN;

*On 1/21/10 a weighting framework was introduced to prevent the assignment of full

values for multiple regions to a single household/state;

*The next few steps are primarily calculations necessary for implementing the

weighting framework,

st_frac_ is the total total number of habitat acres assigned to each state from all

regions for each option;

Proc sql;

create table Annual_Values_1 as

select region,

state,

rest_id,

cost_acre,

numHH,

reg_HH,

frac_tmn1,

frac_tmn2,

frac_tmn3,

frac_tmn4,

frac_baseline,

a_WTP_1,

a_WTP_2,

a_WTP_3,

a_WTP_4,

a_WTP_bas,

sum(frac_tmn1) as st_frac_tmn1,

sum(frac_tmn2) as st_frac_tmn2,

sum(frac_tmn3) as st_frac_tmn3,

sum(frac_tmn4) as st_frac_tmn4,

sum(frac_baseline) as st_frac_baseline

From Annual_Values group by state;

quit;

RUN;

*per_frac_(i) is the fraction of total habitat acres in each state which are

associated with a given state/316(b) region combination,

per_frac_(i) is the WEIGHT which is being applied to regional WTP within a given

state;

Data Annual_Values_2;

Set Annual_Values_1;

array frac_(5) frac_tmn1 frac_tmn2 frac_tmn3 frac_tmn4 frac_baseline;

array st_frac_(5) st_frac_tmn1 st_frac_tmn2 st_frac_tmn3 st_frac_tmn4

st_frac_baseline;

Page 7
HEA_03.21.11.txt

array per_frac_(5) per_frac_tmn1 per_frac_tmn2 per_frac_tmn3 per_frac_tmn4

per_frac_baseline;

array a_WTP_(5) a_WTP_1 a_WTP_2 a_WTP_3 a_WTP_4 a_WTP_bas;

do i=1 to 5;

per_frac_(i)= frac_(i)/st_frac_(i);

END;

DROP i;

RUN;

*p_WTP_(i) is the weighted WTP value for each combination of states and options;

Data Annual_Values_3;

Set Annual_Values_2;

array per_frac_(5) per_frac_tmn1 per_frac_tmn2 per_frac_tmn3 per_frac_tmn4

per_frac_baseline;

array a_WTP_(5) a_WTP_1 a_WTP_2 a_WTP_3 a_WTP_4 a_WTP_bas;

array p_WTP_(5) p_WTP_1 p_WTP_2 p_WTP_3 p_WTP_4 p_WTP_bas;

do i=1 to 5;

p_WTP_(i)= per_frac_(i)* a_WTP_(i);

END;

Drop i;

Drop a_WTP_1 a_WTP_2 a_WTP_3 a_WTP_4 a_WTP_bas;

RUN;

*this step simply converts the array of p_WTP values to a_WTP so the naming

structure is consistent with the

existing HEA code;

Data Annual_Values_4;

Set Annual_Values_3;

array a_WTP_(5) a_WTP_1 a_WTP_2 a_WTP_3 a_WTP_4 a_WTP_bas;

array p_WTP_(5) p_WTP_1 p_WTP_2 p_WTP_3 p_WTP_4 p_WTP_bas;

do i=1 to 5;

a_WTP_(i)=p_WTP_(i);

END;

DROP p_WTP_1 p_WTP_2 p_WTP_3 p_WTP_4 p_WTP_bas;

DROP per_frac_tmn1 per_frac_tmn2 per_frac_tmn3 per_frac_tmn4

per_frac_baseline;

DROP st_frac_tmn1 st_frac_tmn2 st_frac_tmn3 st_frac_tmn4 st_frac_baseline;

RUN;

*change the source of AV_table from Annual_Values to Annual_Values_4;

Proc sql;

create table AV_table as

select region,

state,

rest_id,

cost_acre,

numHH,

reg_HH,

frac_tmn1,

frac_tmn2,

frac_tmn3,

frac_tmn4,

frac_baseline,

a_WTP_1,

a_WTP_2,

a_WTP_3,

a_WTP_4,

a_WTP_bas,

sum(a_WTP_1) as reg_WTP_1,

sum(a_WTP_2) as reg_WTP_2,

sum(a_WTP_3) as reg_WTP_3,

sum(a_WTP_4) as reg_WTP_4,

sum(a_WTP_bas) as reg_WTP_bas

FROM Annual_Values_4 group by region;

quit;

RUN;

Page 8
HEA_03.21.11.txt

*The step below generates a table presenting annual acres by region and option, as

well as annual WTP by region and option.

It also includes restoration cost per acre, however adjustments based on timing of

restoration have not yet been made.;

DATA Reg_Annual_Values;

SET AV_Table;

if state~="total" THEN DELETE;

DROP a_WTP_1 a_WTP_2 a_WTP_3 a_WTP_4 a_WTP_bas;

RUN;

*export data for regional acreages and values;

%export(reg_annual_values,"&outloc.&output",reg_annual_values);

*This is the start of code related to application of the compliance schedule;

/* Calculate Benefits Schedule By Option;*/

*Import facility data with both facility id's;

%import(&inloc.&input,IDMAP,f1);

*Import data with weights;

%import(&inloc.&input,ID_AND_WEIGHT,ID_AND_WEIGHT);

*Import data with region and flow;

%import(&inloc.&input,flowdata,f3);

*Import data with compliance dates;

%import(&inloc.&input,complianceyear,cydata);

*macro for changing the name of the variables names for compliance years under each

option;

%macro cyr;

cydata.tmn1 as cyr_base,

cydata.tmn1 as cyr_tmn1,

cydata.tmn2 as cyr_tmn2,

cydata.tmn3 as cyr_tmn3,

cydata.tmn4 as cyr_tmn4

%mend;

*Get ID for joining datasets;

proc sql;

create table f4 as select

id.plntcode,

w.id as facility,

w.ps_wgt as Weighting_Factor

from f1 as id right join ID_AND_WEIGHT as w on id.surveyid=w.id;

quit;

*Drop double counted plants;

proc sort data=f4 out=f5; by plntcode; run;

data f6;

set f5;

by plntcode;

if (not first.plntcode | not last.plntcode) and

Weighting_Factor=0 then delete;

run;

*join flow and weight data;

proc sql;

create table f7 as select

f6.*,

f3.Benefits_Region,f3.AverageFlow

from f6 full join f3 on f6.plntcode=f3.EIA_Code where f3.EIA_Code~=.;

quit;

*recode region variable;

Page 9
HEA_03.21.11.txt

data f8 (keep=region AverageFlow Weighting_Factor PLNTCODE facility);

set f7;

format region $14.;

if Benefits_Region="CN" | Benefits_Region="CS" |

Benefits_Region="CAL" | Benefits_Region="HI" then region="California";

else if Benefits_Region="GL"

then region="Great Lakes";

else if Benefits_Region="INL"

then region="Inland";

else if Benefits_Region="MA"

then region="Mid-Atlantic";

else if Benefits_Region="Mex"

then region="Gulf of Mexico";

else if Benefits_Region="NA"

then region="North Atlantic";

else if Benefits_Region="SA"

then region="South Atlantic";

run;

*combine and format data with average flow, region, wgt, and compliance year;

proc sql;

create table s2a as select

f8.plntcode,f8.AverageFlow as avgflow,f8.Region,f8.Weighting_Factor

as newweight,

%cyr

from f8 full join cydata on cydata.id=f8.facility;

quit;

RUN;

*5j This macro calculates benefits schedule, incorporating the biological lag and

the lag in compliance;

%macro step5schedule(opt,cyr);

* 5j1 generate benefits schedule;

data s3; *s3 contains plntcodes weights and compliance years along with the flow

arrays (flow arrays are equal to AIF)

and includes the biological fraction as well. It multipolies these to get the

biological schedule;

set s2a;

where region~="Virgin Islands";

array flowy_(60) flowy_1-flowy_60;

array bio(60) bio_1-bio_60;

array bschd(60) bschd_1-bschd_60;

do i=1 to 60;

if "&opt"="baseline" then do;

flowy_(i)=avgflow;

if region="Inland" | region="Great

Lakes" | region="Gulf of Mexico" then do; *benefits begin in first year for these

regions;

*this assumes no biological

lag;

if i=1 then bio(i)=1;

if i=2 then bio(i)=1;

if i=3 then bio(i)=1;

if i=4 then bio(i)=1;

if i=5 then bio(i)=1;

if i=6 then bio(i)=1;

if i>6 and i<=45 then

bio(i)=1;

if i=46 then bio(i)=.83;

if i=47 then bio(i)=.67;

if i=48 then bio(i)=.5;

if i=49 then bio(i)=.33;

Page 10
HEA_03.21.11.txt

if i=50 then bio(i)=.17;

if i>50 then bio(i)=0;

end;

else do; *benefits also begin in the

first year for these regions;

*this assumes no biological

lag;

if i=1 then bio(i)=1;

if i=2 then bio(i)=1;

if i=3 then bio(i)=1;

if i=4 then bio(i)=1;

if i=5 then bio(i)=1;

if i=6 then bio(i)=1;

if i=7 then bio(i)=1;

if i>7 and i<=45 then

bio(i)=1;

if i=46 then bio(i)=.83;

if i=47 then bio(i)=.67;

if i=48 then bio(i)=.5;

if i=49 then bio(i)=.33;

if i=50 then bio(i)=.17;

if i>50 then bio(i)=0;

end;

end;

else do;

if &cyr.>=&ie_year. then

delete; *cyr_ct=2 indicates that there is a tower in place at baseline;

if region="Inland" |

region="Great Lakes" | region="Gulf of Mexico" then do;

*benefits begin in

first year for these regions;

x=i-&cyr.+&t0;

*e.g., if i=1 and cyr = 2011 and first year of rule is 2011 then x=1 in 2011;

if x<=0

then flowy_(i)=0; *x=1 in first year of compliance;

else

flowy_(i)=avgflow;

if _n_=1 then put

"Not BASELINE";

if x<=0

then bio(i)=0;

else if x=1 then

bio(i)=.2;

else if x=2 then

bio(i)=.4;

else if x=3 then

bio(i)=.6;

else if x=4 then

bio(i)=.8;

else if x=5 then

bio(i)=1;

else if x=6 then

bio(i)=1;

else if x=7 then

bio(i)=1;

else if x=8 then

bio(i)=1;

else if x=9 then

bio(i)=1;

else if x>=9 and

Page 11
HEA_03.21.11.txt

i<=45 then bio(i)=1;

else if i=46 then

bio(i)=.83;

else if i=47 then

bio(i)=.67;

else if i=48 then

bio(i)=.5;

else if i=49 then

bio(i)=.33;

else if i=50 then

bio(i)=0.17;

else if i>50 then

bio(i)=0;

end;

else do;

*benefits also

begin in the first year for these regions;

x=i-&cyr.+&t0;

*e.g., if i=1 and cyr = 2011 and first year of rule is 2011 then x=1 in 2012;

if x<0

then flowy_(i)=0;*x=1 in second year of compliance;

else

flowy_(i)=avgflow;

if _n_=1 then put

"Not BASELINE";

if x<=0

then bio(i)=0;

else if x=1 then

bio(i)=.2;

else if x=2 then

bio(i)=.4;

else if x=3 then

bio(i)=.6;

else if x=4 then

bio(i)=.8;

else if x=5 then

bio(i)=1;

else if x=6 then

bio(i)=1;

else if x=7 then

bio(i)=1;

else if x=8 then

bio(i)=1;

else if x=9 then

bio(i)=1;

else if x=10 then

bio(i)=1;

else if x>=10 and

i<=45 then bio(i)=1;

else if i=46 then

bio(i)=.83;

else if i=47 then

bio(i)=.67;

else if i=48 then

bio(i)=.5;

else if i=49 then

bio(i)=.33;

else if i=50 then

bio(i)=0.17;

else if i>50 then

bio(i)=0;

Page 12
HEA_03.21.11.txt

end;

end;

*the fractions here only reflect the fact that the intial compliance year for each

facility reflects a five year average,

in the inputs dataset, these values are converted to the first year by subtracting

two,

the steps of 0.2 reflect staggered implementation over this five year period,

there is not biological lag incorporated in the HEA model, this is strictly related

to compliance;

bschd(i)=(flowy_(i)*bio(i));

end;

format reg $30.;

if region="California"

then reg="calif";

else if region="Great Lakes" then

reg="greatlakes";

else if region="Gulf of Mexico" then

reg="gulfmexico";

else if region="Inland"

then reg="inland";

else if region="Mid-Atlantic" then

reg="midatlantic";

else if region="North Atlantic" then

reg="northatlantic";

else if region="South Atlantic" then

reg="southatlantic";

run;

* 5j2 calculate total average flow by region;

proc sql;

create table s5 as select

s3.*,

sum(avgflow*newweight) as totalavgflow /*group flag*/

from s3 group by region;

quit;

* 5j3 generate flow and benefits schedule variables (for each

facility) as percentages to total regional average flow;

data s6 (drop=bio_1-bio_60 flowy_1-flowy_60);

set s5;

array flowy_(60) flowy_1-flowy_60;

array bschd(60) bschd_1-bschd_60;

do i=1 to 60;

IF totalavgflow~=0 then

flowy_(i)=newweight*flowy_(i)/totalavgflow;

IF totalavgflow=0 then flowy_(i)=0;

IF totalavgflow~=0 then

bschd(i)=newweight*bschd(i)/totalavgflow;

IF totalavgflow=0 then bschd(i)=0;

end;

run;

* 5j4 sort data by region;

proc sort data=s6 out=s7; by region; run;

* 5j6 generate benefits schedule variable for region,

e.g., 1 = full benefits, .5 = 50% of full benefits;

data s8_&opt (keep=option region reg rbschd_1-rbschd_60);

retain option region reg rbschd_1-rbschd_60;

set s7;

by region;

Page 13
HEA_03.21.11.txt

option="&opt";

array bschd(60) bschd_1-bschd_60;

array rbschd(60) rbschd_1-rbschd_60;

do i=1 to 60;

if first.region then rbschd(i)=bschd(i);

else rbschd(i)+bschd(i);

end;

if last.region;

run;

%mend;

%macro step6schedule(opt,cyr);

* 5j1 generate benefits schedule;

data s3; *s3 contains plntcodes weights and compliance years along with the flow

arrays (flow arrays are equal to AIF)

and includes the biological fraction as well. It multipolies these to get the

biological schedule;

set s2a;

where region~="Virgin Islands";

array flowy_(60) flowy_1-flowy_60;

array bio(60) bio_1-bio_60;

array bschd(60) bschd_1-bschd_60;

do i=1 to 60;

if "&opt"="baseline" then do;

flowy_(i)=avgflow;

if region="Inland" | region="Great

Lakes" | region="Gulf of Mexico" then do;

if i=1 then bio(i)=1;

if i=2 then bio(i)=1;

if i=3 then bio(i)=1;

if i=4 then bio(i)=1;

if i=5 then bio(i)=1;

if i=6 then bio(i)=1;

if i>6 and i<=45 then

bio(i)=1;

if i=46 then bio(i)=.83;

if i=47 then bio(i)=.67;

if i=48 then bio(i)=.5;

if i=49 then bio(i)=.33;

if i=50 then bio(i)=.17;

if i>50 then

bio(i)=0;*benefits begin in first year for these regions;

end;

else do;

if i=1 then bio(i)=1;

if i=2 then bio(i)=1;

if i=3 then bio(i)=1;

if i=4 then bio(i)=1;

if i=5 then bio(i)=1;

if i=6 then bio(i)=1;

if i=7 then bio(i)=1;

if i>7 and i<=45 then

bio(i)=1;

if i=46 then bio(i)=.83;

if i=47 then bio(i)=.67;

if i=48 then bio(i)=.5;

if i=49 then bio(i)=.33;

if i=50 then bio(i)=.17;

if i>50 then

bio(i)=0;*benefits also begin in first year for these regions;

end;

end;

Page 14
HEA_03.21.11.txt

else do;

if &cyr.<&ie_year. then

delete;

if region="Inland" |

region="Great Lakes" | region="Gulf of Mexico" then do;

*benefits begin in

first year for these regions;

x=i-&cyr.+&t0;

*e.g., if i=1 and cyr = 2011 and first year of rule is 2011 then x=1 in 2011;

if x<=0

then flowy_(i)=0; *x=1 in first year of compliance;

else

flowy_(i)=avgflow;

if _n_=1 then put

"Not BASELINE";

if x<=0

then bio(i)=0;

else if x=1 then

bio(i)=.2;

else if x=2 then

bio(i)=.4;

else if x=3 then

bio(i)=.6;

else if x=4 then

bio(i)=.8;

else if x=5 then

bio(i)=1;

else if x=6 then

bio(i)=1;

else if x=7 then

bio(i)=1;

else if x=8 then

bio(i)=1;

else if x=9 then

bio(i)=1;

else if x>=9 and

i<=45 then bio(i)=1;

else if i=46 then

bio(i)=.83;

else if i=47 then

bio(i)=.67;

else if i=48 then

bio(i)=.5;

else if i=49 then

bio(i)=.33;

else if i=50 then

bio(i)=0.17;

else if i>50 then

bio(i)=0;

end;

else do;

*benefits also

begin in first year for these regions;

x=i-&cyr.+&t0;

*e.g., if i=1 and cyr = 2011 and first year of rule is 2011 then x=1 in 2012;

if x<0

then flowy_(i)=0;*x=1 in second year of compliance;

else

flowy_(i)=avgflow;

if _n_=1 then put

"Not BASELINE";

Page 15
HEA_03.21.11.txt

if x<=0

then bio(i)=0;

else if x=1 then

bio(i)=.2;

else if x=2 then

bio(i)=.4;

else if x=3 then

bio(i)=.6;

else if x=4 then

bio(i)=.8;

else if x=5 then

bio(i)=1;

else if x=6 then

bio(i)=1;

else if x=7 then

bio(i)=1;

else if x=8 then

bio(i)=1;

else if x=9 then

bio(i)=1;

else if x=10 then

bio(i)=1;

else if x>=10 and

i<=45 then bio(i)=1;

else if i=46 then

bio(i)=.83;

else if i=47 then

bio(i)=.67;

else if i=48 then

bio(i)=.5;

else if i=49 then

bio(i)=.33;

else if i=50 then

bio(i)=0.17;

else if i>50 then

bio(i)=0;

end;

end;

*the fractions here only reflect the fact that the intial compliance

year for each facility reflects a five year average,

in the inputs dataset, these values are converted to the first year

by subtracting two,

the steps of 0.2 reflect staggered implementation over this five

year period,

there is not biological lag incorporated in the HEA model, this is

strictly related to compliance;

bschd(i)=(flowy_(i)*bio(i));

end;

format reg $30.;

if region="California"

then reg="calif";

else if region="Great Lakes" then

reg="greatlakes";

else if region="Gulf of Mexico" then

reg="gulfmexico";

else if region="Inland"

then reg="inland";

else if region="Mid-Atlantic" then

reg="midatlantic";

else if region="North Atlantic" then

reg="northatlantic";

Page 16
HEA_03.21.11.txt

else if region="South Atlantic" then

reg="southatlantic";

run;

* 5j2 calculate total average flow by region;

proc sql;

create table s5 as select

s3.*,

sum(avgflow*newweight) as totalavgflow /*group flag*/

from s3 group by region;

quit;

* 5j3 generate flow and benefits schedule variables (for each

facility) as percentages to total regional average flow;

data s6 (drop=bio_1-bio_60 flowy_1-flowy_60);

set s5;

array flowy_(60) flowy_1-flowy_60;

array bschd(60) bschd_1-bschd_60;

do i=1 to 60;

IF totalavgflow~=0 then

flowy_(i)=newweight*flowy_(i)/totalavgflow;

IF totalavgflow=0 then flowy_(i)=0;

IF totalavgflow~=0 then

bschd(i)=newweight*bschd(i)/totalavgflow;

IF totalavgflow=0 then bschd(i)=0;

end;

run;

* 5j4 sort data by region;

proc sort data=s6 out=s25; by region; run;

* 5j6 generate benefits schedule variable for region,

e.g., 1 = full benefits, .5 = 50% of full benefits;

data s9_&opt (keep=option region reg rbschd_1-rbschd_60);

retain option region reg rbschd_1-rbschd_60;

set s25;

by region;

option="&opt";

array bschd(60) bschd_1-bschd_60;

array rbschd(60) rbschd_1-rbschd_60;

do i=1 to 60;

if first.region then rbschd(i)=bschd(i);

else rbschd(i)+bschd(i);

end;

if last.region;

run;

%mend;

*end of insert from impingement fraction model;

* 5j This macro calculates benefits schedule, incorporating the biological lag

and the lag in compliance;

* 5k Generate dataset of Benefits Schedule By Option;

%macro optionmac11;

%step5schedule(baseline,cyr_base);

%step5schedule(tmn1,cyr_tmn1);

%step5schedule(tmn2,cyr_tmn2);

%step5schedule(tmn3,cyr_tmn3);

%step5schedule(tmn4,cyr_tmn4);

%mend;

%macro optionmac22;

%step6schedule(baseline,cyr_base);

%step6schedule(tmn1,cyr_tmn1);

Page 17
HEA_03.21.11.txt

%step6schedule(tmn2,cyr_tmn2);

%step6schedule(tmn3,cyr_tmn3);

%step6schedule(tmn4,cyr_tmn4);

%mend;

%optionmac11;

%optionmac22;

*step5data contains the benefits schedules for all options for impingement only;

data Step5data;

length option $50.0;

set s8_baseline s8_tmn1 s8_tmn2 s8_tmn3 s8_tmn4;

IF region="" THEN DELETE;

DROP region;

array rbschd_(60) rbschd_1-rbschd_60;

do i=1 to 60;

*know that tmn2 does not have any impingement only, towers everywhere;

IF option="" then rbschd_(i)=0;

END;

run;

proc sort data=step5data out=step5data_1;

by reg;

RUN;

*step20data contains the benefits schedules for all options for towers;

data Step20data;

length option $20.0;

set s9_baseline s9_tmn1 s9_tmn2 s9_tmn3 s9_tmn4;

IF region="" THEN DELETE;

DROP region;

array rbschd_(60) rbschd_1-rbschd_60;

array sbschd_(60) sbschd_1-sbschd_60;

Do i=1 to 60;

sbschd_(i)=rbschd_(i);

DROP rbschd_1-rbschd_60;

END;

run;

proc sort data=step20data out=step20data_1;

by reg;

RUN;

*comp_calcs contains the seperate benefit schedules for each for impingement only

(step5data) and towers (step20data);

data comp_calcs;

merge step5data_1 step20data_1;

by reg option;

run;

Proc sort data=comp_calcs out=comp_calcs;

by reg option;

Run;

*ie_imp brings in the impingement fraction which needs to be applied to the

comp_calcs sheet;

Data ie_imp;

SET ie (KEEP = option_name region metric comrec_type species_econ

impingement_fraction);

IF metric="ae1.lbs";

IF comrec_type="all.types";

IF species_econ="zz.all.species";

IF region~="zz.allregions";

If option_name="option.tmn1" then option="tmn1";

else if option_name="option.tmn2" then option="tmn2";

else if option_name="option.tmn3" then option="tmn3";

else if option_name="option.tmn4" then option="tmn4";

reg=region;

Drop option_name;

Drop region;

Run;

Page 18
HEA_03.21.11.txt

Proc sort data=ie_imp out=ie_imp;

by reg option;

Run;

*comp_imp merges the impingement only and towers benefits schedules with the

schedules the impingement fraction;

data comp_imp;

length option $20;

merge ie_imp comp_calcs;

by reg option;

run;

*comp_calcs_1 calculates the final benefit schedule which incorporates the benefit

fraction;

data comp_calcs_1;

set comp_imp;

array rbschd_(60) rbschd_1-rbschd_60;

array sbschd_(60) sbschd_1-sbschd_60;

array fschd_(60) fschd_1-fschd_60;

Do i=1 to 60;

IF rbschd_(i)="." then rbschd_(i)=0;

IF sbschd_(i)="." then sbschd_(i)=0;

fschd_(i)=(impingement_fraction*rbschd_(i)+((1-impingement_fraction)*sbschd_(i)));

IF impingement_fraction="" then fschd_(i)=rbschd_(i);

End;

Run;

*comp_calcs_2 is comp_calcs_1 after having rows dropped, transposed, and having some

variable names changedit results in the final biological schedules being listed vertically;

DATA comp_calcs_2;

SET comp_calcs_1;

Drop rbschd_1-rbschd_60;

Drop sbschd_1-sbschd_60;

Drop impingement_fraction metric comrec_type species_econ i;

Drop i;

RUN;

*************************************************************************

REPOWERING CALCS START

*************************************************************************;

%import(&inloc.&input2,rep_adj,rep_adj);

%import(&inloc.&input,rpschd,rpschd);

Proc sort data=rep_adj out=rep_adj;

by option;

RUN;

Proc sort data=rpschd out=rpschd;

by option;

RUN;

Data repow;

merge rep_adj rpschd;

by option;

adj=1/rp_adj;

drop rp_adj;

RUN;

Data repow_1;

set repow;

array rpschd_(60) rpschd_1-rpschd_60;

array rpschd_adj_(60) rpschd_adj_1-rpschd_adj_60;

do i=1 to 60;

rpschd_adj_(i)=rpschd_(i)*(1-adj);

if rpschd_(i)=0 then rpschd_adj_(i)=0;

end;

Page 19
HEA_03.21.11.txt

drop rp_adj rpschd_1-rpschd_60 i;

if lossmode="imp" then delete;

if lossmode="ent" then delete;

if region="zz.allregions" then delete;

if option= "baseline_0" | option="tmn1_0" | option="tmn2_0" |

option="tmn3_0" | option="tmn4_0" then delete;

reg=region;

drop region lossmode; *all values only refer to IE combined;

RUN;

Proc Sort data=repow_1 out=repow_1;

by option reg;

RUN;

Proc Sort data=comp_calcs_2 out=comp_calcs_2;

by option reg;

RUN;

Data comp_calcs_2;

merge repow_1 comp_calcs_2;

by option reg;

RUN;

Data comp_calcs_2;

set comp_calcs_2;

array fschd_(60) fschd_1-fschd_60;

array rpschd_adj_(60) rpschd_adj_1-rpschd_adj_60;

array fschd_adj_(60) fschd_adj_1-fschd_adj_60;

do i = 1 to 60;

fschd_adj_(i)=fschd_(i)*adj + rpschd_adj_(i);

fschd_(i) = fschd_adj_(i);

END;

drop i rpschd_adj_1-rpschd_adj_60 fschd_adj_1-fschd_adj_60 adj;

RUN;

Proc sort data=comp_calcs_2 out=comp_calcs_2;

by reg option;

RUN;

*************************************************************************

END OF REPOWERING CALCULATIONS

*************************************************************************;

*comp_calcs_3 has both the benefits and cost schedule included;

Data comp_calcs_3;

SET comp_calcs_2;

array fschd_(60)fschd_1-fschd_60;

array cs_(59) cs_01-cs_59;

do i= 1 to 59;

cs_(i)= fschd_(i+1)-fschd_(i);

IF i>=20 then cs_(i)=0;

cs_00=fschd_1;

drop i;

END;

RUN;

*seperate the benefit schedule (fschd)from the cost schedule(cs);

*ben_schd is the benefit schedule;

Data ben_schd;

Set comp_calcs_3 (rename=(reg=region));

Drop cs_00-cs_59;

Run;

*rcost_schd is the restoration cost schedule;

Data rcost_schd;

Set comp_calcs_3 (rename=(reg=region));

Page 20
HEA_03.21.11.txt

Drop fschd_1-fschd_60;

Run;

*transpose both data sets into a vertical format;

*ben_schd_1 is the transposed benefit schedule;

Proc Transpose data=ben_schd out=ben_schd_1;

by region;

id option;

Run;

*need to rename former variable _name_ as "fschd";

Data ben_schd_2;

Set ben_schd_1 (rename=(_name_=fschd));

Run;

*rcost_schd_1 is the transposed restoration cost schedule;

Proc Transpose data=rcost_schd out=rcost_schd_1;

by region;

id option;

Run;

*need to sort the rest cost schedule data by region and and cs_schd in order to get

cs_99-cs_59 in the correct order;

Proc Sort data=rcost_schd_1 out=rcost_schd_1;

by region _name_;

Run;

*merge the benefits and restoration cost schdules back together, comb_schd;

*need to different option names under the restoration cost schedule before merging

with the benefits schedule;

DATA rcost_schd_2;

SET rcost_schd_1 (rename=(_name_=cs_schd));

array tmn(5) tmn1 tmn2 tmn3 tmn4 baseline;

array csn(5) csn1 csn2 csn3 csn4 csn_baseline;

do i=1 to 5;

csn(i)=tmn(i);

END;

DROP tmn1 tmn2 tmn3 tmn4 baseline;

Drop i;

run;

*comb_schd has the combined benefit and restoration cost schedules, edit to

incorporate regional WTP values, acreages, and costs;

Data comb_schd;

merge ben_schd_2 rcost_schd_2;

by region;

Run;

DATA Reg_annual_values_1;

length region $20;

format region $20.;

SET reg_annual_values;

DROP rest_id state;

RUN;

*the comb_calcs file combine the combined benefits schedule with the annual WTP

values (Annual_wtp) and the annual acreages (Annual_acres);

*also add in period, year, and discount factors in the same step;

Data comb_schd_1;

merge comb_schd reg_annual_values_1;

by region;

Drop numHH reg_HH;

DO year=substr(fschd,7);

END;

period = year+(&t0.-&yrba.);

df_3=(1/(1.03**period));

df_7=(1/(1.07**period));

Run;

*add in the calculations for WTP and restoration costs;

DATA comb_schd_2;

SET comb_schd_1;

Page 21
HEA_03.21.11.txt

array p3_WTP_(5) p3_WTP_1 p3_WTP_2 p3_WTP_3 p3_WTP_4 p3_WTP_bas;

array p7_WTP_(5) p7_WTP_1 p7_WTP_2 p7_WTP_3 p7_WTP_4 p7_WTP_bas;

array reg_WTP_(5) reg_WTP_1 reg_WTP_2 reg_WTP_3 reg_WTP_4 reg_WTP_bas;

array p3_rc_(5) p3_rc_1 p3_rc_2 p3_rc_3 p3_rc_4 p3_rc_bas;

array p7_rc_(5) p7_rc_1 p7_rc_2 p7_rc_3 p7_rc_4 p7_rc_bas;

array tmn(5) tmn1 tmn2 tmn3 tmn4 baseline;

array csn(5) csn1 csn2 csn3 csn4 csn_baseline;

array frac(5) frac_t1 frac_t2 frac_t3 frac_t4 frac_baseline;

do i= 1 to 5;

p3_WTP_(i)=tmn(i)*reg_WTP_(i)*df_3;

p7_WTP_(i)=tmn(i)*reg_WTP_(i)*df_7;

p3_rc_(i)=(csn(i)*frac(i)*cost_acre*df_3)/1000;

p7_rc_(i)=(csn(i)*frac(i)*cost_acre*df_7)/1000;

END;

RUN;

*sum WTP values for each option at a 3% discount rate;

Proc sql;

create table annual_WTP_3 as

select region,

sum(p3_WTP_1)*&af_3. as tmn1,

sum(p3_WTP_2)*&af_3. as tmn2,

sum(p3_WTP_3)*&af_3. as tmn3,

sum(p3_WTP_4)*&af_3. as tmn4,

sum(p3_WTP_bas)*&af_3. as baseline

FROM comb_schd_2 group by region;

RUN;

*sum WTP values for each option at a 7% discount rate;

Proc sql;

create table annual_WTP_7 as

select region,

sum(p7_WTP_1)*&af_7. as tmn1,

sum(p7_WTP_2)*&af_7. as tmn2,

sum(p7_WTP_3)*&af_7. as tmn3,

sum(p7_WTP_4)*&af_7. as tmn4,

sum(p7_WTP_bas)*&af_7. as baseline

FROM comb_schd_2 group by region;

RUN;

%export(annual_wtp_3,"&outloc.&output",annual_wtp_3);

%export(annual_wtp_7,"&outloc.&output",annual_wtp_7);

*sum annual restoration costs for each option at a 3% discount rate;

Proc sql;

create table annual_rc_3 as

select region,

sum(p3_rc_1)*&af_3. as tmn1,

sum(p3_rc_2)*&af_3. as tmn2,

sum(p3_rc_3)*&af_3. as tmn3,

sum(p3_rc_4)*&af_3. as tmn4,

sum(p3_rc_bas)*&af_3. as baseline

FROM comb_schd_2 group by region;

RUN;

*sum annual restoration costs for each option at a 7% discount rate;

Proc sql;

create table annual_rc_7 as

select region,

sum(p7_rc_1)*&af_7. as tmn1,

sum(p7_rc_2)*&af_7. as tmn2,

sum(p7_rc_3)*&af_7. as tmn3,

sum(p7_rc_4)*&af_7. as tmn4,

sum(p7_rc_bas)*&af_7. as baseline

FROM comb_schd_2 group by region;

RUN;

*%export(annual_rc_3,"&outloc.&output",annual_rc_3);

Page 22
HEA_03.21.11.txt

*%export(annual_rc_7,"&outloc.&output",annual_rc_7);

*create tables for export in rtf format;

Data reg_annual_values_2;

Set reg_annual_values_1;

IF region="calif" then region="California";

IF region="greatlakes" then region="Great Lakes";

IF region="gulfmexico" then region="Gulf of Mexico";

IF region="southatlantic" then region="South Atlantic";

IF region="northatlantic" then region="North Atlantic";

IF region="midatlantic" then region="Mid-atlantic";

IF region="inland" then region="Inland";

DROP cost_acre numHH;

Run;

*create revised data set for regional, annualized WTP at 3% discount rate;

Data annual_wtp_3_1;

length region $20;

Set annual_wtp_3;

format tmn1 tmn2 tmn3 tmn4 baseline comma20.;

RUN;

*create revised data set for regional, annualized WTP at 7% discount rate;

Data annual_wtp_7_1;

length region $20;

Set annual_wtp_7;

format tmn1 tmn1 tmn3 tmn4 baseline comma20.;

RUN;

*create table for annual acres;

Proc sql;

create table reg_annual_acres_1 as

select region,

reg_HH as Households format=comma30.,

frac_baseline as baseline format=comma30.,

frac_tmn1 as tmn1 format=comma30.,

frac_tmn2 as tmn2 format=comma30.,

frac_tmn3 as tmn3 format=comma30.,

frac_tmn4 as tmn4 format=comma30.

FROM reg_annual_values_2;

RUN;

*create a dataset which merges results for Region, HHs, Species, WTP per acre,

Equivalent Acres, WTP (3%), and WTP (7%);

Proc Sort data=reg_annual_acres_1 out=reg_annual_acres_2;

by region households;

Run;

Proc Transpose data=reg_annual_acres_2 out=reg_annual_acres_2;

by region households;

var baseline tmn1 tmn2 tmn3 tmn4;

Run;

Data reg_annual_acres_2;

set reg_annual_acres_2 (rename=(_NAME_=option col1=Acres));

IF region="California" then region="calif";

IF region="Great Lakes" then region="greatlakes";

IF region="Gulf of Mexico" then region="gulfmexico";

IF region="South Atlantic" then region="southatlantic";

IF region="North Atlantic" then region="northatlantic";

IF region="Mid-atlantic" then region="midatlantic";

IF region="Inland" then region="inland";

Run;

Proc Sort data=annual_wtp_3 out=annual_wtp_3_2;

by region;

Run;

Proc Transpose data=annual_wtp_3_2 out=annual_wtp_3_2;

Page 23
HEA_03.21.11.txt

by region;

var baseline tmn1 tmn2 tmn3 tmn4;

Run;

Data annual_wtp_3_2;

set annual_wtp_3_2 (rename=(_NAME_=option col1=WTP_3));

Run;

Proc Sort data=annual_wtp_7 out=annual_wtp_7_2;

by region;

Run;

Proc Transpose data=annual_wtp_7_2 out=annual_wtp_7_2;

by region;

var baseline tmn1 tmn2 tmn3 tmn4;

Run;

Data annual_wtp_7_2;

set annual_wtp_7_2 (rename=(_NAME_=Option col1=WTP_7));

Run;

*Annual_results summarizes results for all options and regions and includes

households, Equivalent Acres, WTP (3%), and WTP (7%);

Data Annual_Results;

Merge reg_annual_acres_2 annual_wtp_3_2 annual_wtp_7_2;

by region option;

format WTP_3 comma20.;

format WTp_7 comma20.;

Run;

*specify the names of options included in the runs;

%let optionlist=baseline^tmn1^tmn2^tmn3^tmn4;

*specify the names of region included in the runs;

%let

reglist=calif^greatlakes^inland^midatlantic^gulfmexico^northatlantic^southatlantic;

*this macro generates a seperate table for each option which displays the results

for all regions;

%macro optiontables;

%Do j=1 %to 4;

%let option_cur=%scan(&optionlist,&j,^);

DATA dat_&option_cur;

Set Annual_Results;

IF option~="&option_cur." then delete;

IF region="calif" then region="California";

IF region="greatlakes" then region="Great Lakes";

IF region="gulfmexico" then region="Gulf of Mexico";

IF region="southatlantic" then region="South Atlantic";

IF region="northatlantic" then region="North Atlantic";

IF region="midatlantic" then region="Mid-atlantic";

IF region="inland" then region="Inland";

RUN;

Proc sql;

create table tab_&option_cur as select

region as Region,

option as Option,

households as Households,

acres as Acres,

WTP_3 as WTP_3,

WTP_7 as WTP_7

from dat_&option_cur;

quit;

%END;

%mend;

*this macro generates a seperate table for each region which displays the results

for each option;

%macro regtables;

Page 24
HEA_03.21.11.txt

%Do i=1 %to 7;

%let reg_cur=%scan(®list,&i,^);

DATA dat_®_cur;

Set Annual_Results;

IF region~="®_cur." then delete;

IF region="calif" then region="California";

IF region="greatlakes" then region="Great Lakes";

IF region="gulfmexico" then region="Gulf of Mexico";

IF region="southatlantic" then region="South Atlantic";

IF region="northatlantic" then region="North Atlantic";

IF region="midatlantic" then region="Mid-atlantic";

IF region="inland" then region="Inland";

RUN;

Proc sql;

create table tab_®_cur as select

region as Region,

option as Option,

households as Households,

acres as Acres,

WTP_3 as WTP_3,

WTP_7 as WTP_7

from dat_®_cur;

quit;

%END;

%mend;

%optiontables;

%regtables;

*the following macro outputs the results tables in rtf format;

*%macro rtfprint;

*ods rtf body="&printout";

*title "Equivalent Acres per Year by Region and Option";

*Proc print data=reg_annual_acres_1 NOOBS;

*RUN;

*title "Annualized WTP by Region (3% discount rate)(1,000s of 2008$)";

*Proc print data=annual_wtp_3_1 NOOBS;

*RUN;

*title "Annualized WTP by Region (7% discount rate)(1,000s of 2008$)";

*Proc print data=annual_wtp_7_1 NOOBS;

*RUN;

*this following section of code prints out the option-specific tables;

*%DO j=1 %to 4;

* %let option_cur=%scan(&optionlist,&j,^);

* title "Equivalent Acres and Total WTP - &option_cur. (All

Regions)(WTP in 1,000s of 2008$)";

* PROC PRINT data=tab_&option_cur NOOBS;

* RUN;

*%END;

*this following section of code prints out the region-specific tables for all

options;

*%DO j=1 %to 7;

* %let reg_cur=%scan(®list,&j,^);

* title "Equivalent Acres and Total WTP - ®_cur. (All

Options)(WTP in 1,000s of 2008$)";

* PROC PRINT data=tab_®_cur NOOBS;

* RUN;

*%END;

*ods rtf close;

*%mend;

*%rtfprint;

Page 25