bt-star_main_03.21.11.txt

Author: Abt Associates Inc. Created: 2/5/2010; Updated: 3/22/2011; Purpose: This is a SAS program which calculates non-use benefits using a benefits transfer approach based on the Johnston et al. (2009)

*As of 2/09/10, seperate compliance schedules are implementd for facilities assigned IM and CT based on "ie_year" *As of 2/09/10, it includes a household weighting structure using proportion of total habitat acres assigned to a state. *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\BT-STAR\;

%let inloc=&mainloc.Inputs\; %let outloc=&mainloc.Outputs\;

libname outloc "&outloc";

*input assumptions;

%let t0=2012; *(define time zero); %let yrsc=50; *(define the annualization period); %let yrba=2012; *(define the base year for discounting); %let ie_year=2017; *(define the first year of I&E for towers compliance, all year prior just impingement only);

%let af_3=(0.03*(1.03**50))/((1.03**50)-1); *(define the 3% annualization factor by changing the number compliance years);

%let af_7=(0.07*(1.07**50))/((1.07**50)-1); *(define the 7% annualization factor by changing the number compliance years);

*define species that is being analyzed in the north atlantic and mid-atlantic regions;%let species_1="winter.flounder"; *species_#a is the name each species as it will be presented in final tables;

%let species_1a="Winter Flounder";

*The name of the input file is;

%let input=BT_STAR_Inputs_03.21.11.xls; %let input2=IE_outputs_22MAR11.xls; *The name of the output files are;

%let output=BT_BenOutputs_&sysdate..xls; %let tables=BT_BenTables_&sysdate..xls; %let SumTables=BT_BenTablesSum_&sysdate..xls; %let printout=&outloc.BT Ben Tables &sysdate..rtf; %let printout3=&outloc.BT 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; Page 1bt-star_main_03.21.11.txt

%macro export(datafile,outfile,sheet); PROC EXPORT DATA= &datafile

OUTFILE= &outfile DBMS=EXCEL replace; SHEET=&sheet;

RUN; %mend;

*import data from excel;

*import facility data; %import(&inloc.&input,facility_data,facility_data); *import household data; %import(&inloc.&input,HH_data_reg,HH_1); *import population change data; %import(&inloc.&input,abun_change,abun_change); *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 "impingment fraction" I&E; DATA reductions_detail;

SET reductions_detail; if region="" then delete; DROP regional_reduction_imp regional_reduction_ent ccr_fraction_ent benefit_value_regional_imp;

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 baseline_value_regional benefit_value benefit_value_regional regional_reduction ccr_fraction;

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 baseline_value_regional benefit_value benefit_value_regional regional_reduction ccr_fraction;

RUN; PROC SORT data=ent_only_1;

by option_name region value_basis species_econ metric comrec_type; Page 2bt-star_main_03.21.11.txt

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; DROP regional_reduction ccr_fraction; 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;

*length impingement_fraction $50.0; 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=((imp_frac_imp*imp_benefit_value_regional)/ie_benefit_value_reg ional);

END;

IF ie_benefit_value_regional=0 then do impingement_fraction="";

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 baseline_value_regional benefit_value 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;

***************************************************************** *edit region names; DATA facility_data; Set facility_data; IF Region="CN" or Region ="CS" or Region ="HI" then reg="CAL"; IF Region="INL" then reg="INL"; IF Region="GL" then reg="GL"; IF Region="MA" then reg="MA"; IF Region="NA" then reg="NA"; IF Region="SA" then reg="SA"; IF Region="Mex" then reg="Mex"; IF Region="VI" then reg="VI"; IF Region="PNW" then reg="PNW";

RUN; Page 3bt-star_main_03.21.11.txt

*Under the current model framework, all species have populations which cover the North Atlantic and Mid-Atlantic regions;

PROC Sort data=abun_change out=abun_change;

by reg;

RUN;

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

*

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

* generate regional annual WTP values for mid-atlantic and north atlantic regions based on estimated increases in abundance; *reports total for the NORTHEAST (North Atlantic + Mid-Atlantic); Data reg_compile;

Merge HH_1 abun_change; by reg; array tmn(5) NE_baseline NE_tmn1 NE_tmn2 NE_tmn3 NE_tmn4; array WTPhh(5) WTPhh_baseline WTPhh_tmn1 WTPhh_tmn2 WTPhh_tmn3 WTPhh_tmn4; array WTPreg(5) WTPreg_baseline WTPreg_tmn1 WTPreg_tmn2 WTPreg_tmn3 WTPreg_tmn4;

do i=1 to 5; *WTPhh(i) is the household WTP per year for the baseline percentage changes and the change under each option;

WTPhh(i)=tmn(i)*WTPper; *WTPreg(i) is the product of household WTP per and the the total number of households in each region;

*Reginal WTP is expressed in 1,000s of dollars; WTPreg(i)=WTPhh(i)*numHH/1000;

END; DROP baseline tmn1 tmn2 tmn3 tmn4 i;

RUN;

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

**

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

** ALL REMAINING STEPS ARE RELATED TO DISCOUNTING/COMPLIANCE SCHEDULE!; *This step trims the I&E input data set and limits it to age 1 equivalents for the species of interest "species_1"; *Table ie_2 sums up the total baselines I&E and reductions for each species over the entirety of the Northeast (North Atlantic plus Mid-Atlantic); *The purpose of the following two data steps is to manipulate the data so the compliance schedule can be properly applied, especially considering the impingement fraction; data ie;set ie;

if species_econ~="winter.flounder" then delete; if metric~="ae1" then delete; if comrec_type~="all.types" then delete; if region="zz.allregions" then delete;

RUN;

Proc sql;

create table ie_2 as select option_name, region, species_econ, lossmode, metric,
comrec_type, Page 4bt-star_main_03.21.11.txt baseline_value_regional, benefit_value_regional, impingement_fraction, sum(baseline_value_regional) as baseline_sum, sum(benefit_value_regional) as benefit_sum From ie group by option_name,species_econ; Quit; Data ie_3;

Set ie_2; IF species_econ~="winter.flounder" then delete; baseline_frac=baseline_value_regional/baseline_sum; benefit_frac=benefit_value_regional/benefit_sum; IF option_name="option.tmn1" then option="tmn1"; IF option_name="option.tmn2" then option="tmn2"; IF option_name="option.tmn3" then option="tmn3"; IF option_name="option.tmn4" then option="tmn4"; DROP option_name; reg=region; DROP region;

RUN; *need to input the compliance schedule;

*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 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~=.; Page 5bt-star_main_03.21.11.txt

quit;

*recode region variable; *delete facilities for other regions; 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 delete;

else if Benefits_Region="GL" then delete; else if Benefits_Region="INL" then delete; else if Benefits_Region="MA" then region="Mid-Atlantic"; else if Benefits_Region="Mex" then delete; else if Benefits_Region="NA" then region="North Atlantic"; else if Benefits_Region="SA" then delete; else if Benefits_Region="VI" then delete; else if Benefits_Region="PNW" then delete;

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; DATA s2a;

SET s2a; if region ="Inland" | region="California" | region="South Atlantic" | region="South Atlantic" | region="Great Lakes" | region="Gulf of Mexico" then delete;if cyr_base="." then delete;

if PLNTCODE="." then delete;

RUN;

*5j This macro calculates benefits schedule for impingement only facilities; *assumes no biological lag; *this step is implemented seperately for facilities getting towers; %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 multiplies 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;

Page 6bt-star_main_03.21.11.txt 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; 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; 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; 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; Page 7bt-star_main_03.21.11.txt 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";

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; Page 8bt-star_main_03.21.11.txt 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 BT 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

Page 9bt-star_main_03.21.11.txt

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 ; 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; *This step generates the benefits schedule for facilities assigned towers; *assumes no biological lag; %macro step6schedule(opt,cyr); data s4; *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 multiplies 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; Page 10bt-star_main_03.21.11.txtif 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 the first for these regions; end; end;

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 Page 11bt-star_main_03.21.11.txt

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";

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 BT model, this is strictly related to compliance;

bschd(i)=(flowy_(i)*bio(i)); end; format reg $30.; Page 12bt-star_main_03.21.11.txt 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

s4.*, sum(avgflow*newweight) as totalavgflow /*group flag*/ from s4 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; * 5j This macro calculates benefits schedule, incorporating the biological lag and the lag in compliance; * 5k Generate dataset of Benefits Schedule By Option; %macro optionmac00; Page 13bt-star_main_03.21.11.txt %step5schedule(baseline,cyr_base); %step5schedule(tmn1,cyr_tmn1); %step5schedule(tmn2,cyr_tmn2); %step5schedule(tmn3,cyr_tmn3); %step5schedule(tmn4,cyr_tmn4); %mend;

%macro optionmac11;

%step6schedule(baseline,cyr_base); %step6schedule(tmn1,cyr_tmn1); %step6schedule(tmn2,cyr_tmn2); %step6schedule(tmn3,cyr_tmn3); %step6schedule(tmn4,cyr_tmn4); %mend; %optionmac00; %optionmac11; *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 $50.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;

LENGTH option $20; SET ie (KEEP = option_name region metric comrec_type species_econ impingement_fraction);

If option_name="option.tmn1" then option="tmn1"; Page 14bt-star_main_03.21.11.txt 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"; if species_econ~="winter.flounder" then delete; if region="zz.allregions" then delete; if metric~="ae1" then delete; if comrec_type~="all.types" then delete; drop option_name; reg=region; drop region; drop species_econ; drop metric; drop comrec_type;

RUN;

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;

merge ie_imp comp_calcs; by reg option; if option="baseline" then impingement_fraction=0;

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);

max_fschd=round(max(of fschd_1-fschd_60),.000000000000001);*included to account for rounding error.

*max(of fschd_1-fschd_60) ~= 1 then put _n_ "error flag 1 - fschd does not sum to 1"; End;

Run; *data checks; data comp_calcs_1;

set comp_calcs_1; if max_fschd >1 then put _n_ "error flag 1 - fschd is greater than 1 " max_fschd;

if max_fschd <1 then put _n_ "error flag 2 - fschd is less than 1 " max_fschd;

RUN;

****************************************************************************** comp_calcs_2 contains the final compliance schedule for each option the final biological schedules is listed vertically; DATA comp_calcs_2;

SET comp_calcs_1; Drop rbschd_1-rbschd_60; Drop sbschd_1-sbschd_60; Drop impingement_fraction; Drop i max_fschd;

RUN;

****************************************************************************** Page 15bt-star_main_03.21.11.txt

Start of repowering calculations;

%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; drop rp_adj rpschd_1-rpschd_60 i; if lossmode="imp" then delete; if lossmode="ent" then delete; if region="zz.allregions" | region="calif" | region="southatlantic" | region="greatlakes" | region="gulfmexico" | region="inland" 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;

Page 16bt-star_main_03.21.11.txt

*end of repowering calculations *************************************************************************;

PROC SORT data=ie_3 out=ie_3;

by reg;

RUN; *make changes to ie_3 to delete extraneous variables; Data ie_3;

LENGTH option $20; Set ie_3; DROP lossmode metric comrec_type baseline_value_regional benefit_value_regional impingement_fraction baseline_sum benefit_sum;

DROP lossmode metric comrec_type baseline_value_regional benefit_value_regional baseline_sum benefit_sum;

RUN; *this data step generates baseline option for inclusion in the ie data set; DATA ie_baseline;

Set ie_3; IF option~="tmn1" then delete; benefit_frac=baseline_frac; option="baseline";

RUN; *this data step merges the baseline option back with the rest of the ie data set; *baseline_frac can be dropped because benefit_frac and baseline_frac have been equalized for the baseline option; PROC SORT data=ie_baseline out=ie_baseline;

by option species_econ reg;

RUN; PROC SORT data=ie_3 out=ie_3;

by option species_econ reg;

RUN; DATA ie_all;

MERGE ie_baseline ie_3; by option species_econ reg; DROP baseline_frac;

RUN; *comp_calcs_2 contains the final benefits shedule for the mid-atlantic and north atlantic regions these need to be combined in order to treat the northeast (north atlantic & mid-atlantic) as a single population; *the final schedules presented in comp_calcs_2 are generalized for all facilities and do not yet reflect species-specific adjustments related to the location of population losses (north atlantic vs mid-atlantic);

*sort comp_calcs_2 and ie_all before merging with ie_data; PROC SORT data=comp_calcs_2 out=comp_calcs_2;

by option reg;

RUN;

PROC SORT data=ie_all out=ie_all;

by option reg species_econ;

RUN;

*comp_calcs_4 contains each option/species combination along the final benefits schedule (impingement fraction adjusted) for each; DATA comp_calcs_4;

LENGTH option $20; Merge ie_all comp_calcs_2; by option reg; DROP baseline_frac;

RUN; *the next few stesps breaks comp_calcs_4 into two separate data set for the Page 17bt-star_main_03.21.11.txt

north_atlantic and mid_atlantic which will be merged back together; *comp_calcs_5 is restricted to the mid-atlantic schedule; DATA comp_calcs_5;

Set comp_calcs_4; IF reg="northatlantic" then delete; array ma_schd_(60) ma_schd_1-ma_schd_60; array fschd_(60) fschd_1-fschd_60; Do i=1 to 60; ma_schd_(i)=fschd_(i)*benefit_frac;

END; DROP fschd_1-fschd_60 benefit_frac reg i;

RUN; *comp_calcs_6 is restricted to the north atlantic schedule; DATA comp_calcs_6;

Set comp_calcs_4; IF reg="midatlantic" then delete; array na_schd_(60) na_schd_1-na_schd_60; array fschd_(60) fschd_1-fschd_60; Do i=1 to 60; na_schd_(i)=fschd_(i)*benefit_frac;

END; DROP fschd_1-fschd_60 benefit_frac reg i;

RUN; PROC SORT data=comp_calcs_5 out=comp_calcs_5;

by option species_econ;

RUN; PROC SORT data=comp_calcs_6 out=comp_calcs_6;

by option species_econ;

RUN;

*comp_calcs_7 merges the adjusted schedules for the mid-atlantic and north atlantic regions and calculates a weighted northeast schedule (ne_schd); Data comp_calcs_7;

Merge comp_calcs_5 comp_calcs_6; by option species_econ; array ma_schd_(60) ma_schd_1-ma_schd_60; array na_schd_(60) na_schd_1-na_schd_60; array ne_schd_(60) ne_schd_1-ne_schd_60; Do i=1 to 60; IF na_schd_(i)="." then na_schd_(i)=0; ne_schd_(i)=ma_schd_(i) + na_schd_(i);

END; RUN; *This step modifies the Reg_compile dataset so it can be merged together with the final compliance schedule; DATA Reg_compile_1;

Set reg_compile; DROP tmn1 tmn2 tmn3 tmn4 baseline;
DROP WTPper; DROP WTPhh_tmn1 WTPhh_tmn2 WTPhh_tmn3 WTPhh_tmn4 WTPhh_baseline;

RUN; *reg_compile_2 lists each species under evaulation in the north atlantic and mid-atlantic regions along with the reg benefits under each option for each species; DATA reg_compile_2;

Set reg_compile_1; array WTPreg_(5) WTPreg_tmn1 WTPreg_tmn2 WTPreg_tmn3 WTPreg_tmn4 WTPreg_baseline;

array tmn(5) tmn1 tmn2 tmn3 tmn4 baseline; do i=1 to 5; tmn(i)=WTPreg_(i);

END; Page 18bt-star_main_03.21.11.txt DROP WTPreg_tmn1 WTPreg_tmn2 WTPreg_tmn3 WTPreg_tmn4 WTPreg_baseline NE_baseline NE_tmn1 NE_tmn2 NE_tmn3 NE_tmn4;

DROP regHH; DROP i;

RUN; *The following three data/proc steps reorganize the data so that the WTP results can be merged with the

weighted northeast compliance schedule; PROC sort data=reg_compile_2 out=reg_compile_2;

by reg species_econ;

RUN; *reg_compile_2 should be exported and saved as it contains the annual regional benefits for each species/option for both the north atlantic and mid-atlantic regions; PROC Transpose data=reg_compile_2 out=reg_compile_3;

By reg species_econ;

RUN; DATA reg_compile_3;

SET reg_compile_3 (rename=(_NAME_=option COl1=WTPreg));

RUN; PROC SORT data=reg_compile_3 out=reg_compile_3;

by option species_econ reg;

RUN;

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

**** *comp_calcs_8 strips out the seperate schedules for the mid-atlantic and north atlantic to estimate the net compliance shedule for northeast waters; Data comp_calcs_8;

SET comp_calcs_7; DROP ma_schd_1-ma_schd_60 na_schd_1-na_schd_60 i;

RUN;

PROC SORT data=comp_calcs_8 out=comp_calcs_8;

by option species_econ;

RUN; *merge together the annual regional WTP values and the weighted northeast compliance schedule for each species/option; DATA reg_compile_4;

merge reg_compile_3 comp_calcs_8; by option species_econ;

RUN;

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

************************* *incorporate year into the data set for discounting and implement all discounting and annualization calcs; *reg_compile_5 includes raw results prior to sorting; DATA reg_compile_5;

Set reg_compile_4; array yr_(60) yr_1-yr_60; array ne_schd_(60) ne_schd_1-ne_schd_60; array df3_(60) df3_1-df3_60; array df7_(60) df7_1-df7_60; array WTP3_(60) WTP3_1-WTP3_60; array WTP7_(60) WTP7_1-WTP7_60; do i=1 to 60; yr_(i)=i; df3_(i)=1/(1.03**yr_(i)); df7_(i)=1/(1.07**yr_(i)); WTP3_(i)=WTPreg*ne_schd_(i)*df3_(i); WTP7_(i)=WTPreg*ne_schd_(i)*df7_(i);

END; *calculate NPV for 3% discount rate and 7% discount rate; Page 19bt-star_main_03.21.11.txt WTP_NPV_3=sum(of WTP3_1-WTP3_60); WTP_NPV_7=sum(of WTP7_1-WTP7_60); Ann_WTP_3=WTP_NPV_3*&af_3.; Ann_WTP_7=WTP_NPV_7*&af_7.;

RUN; Data discounting_out; set reg_compile_5; if reg~="northeast" then delete; if _LABEL_="numHH" then delete; drop _LABEL_ species_econ ne_schd_1-ne_schd_60 yr_1-yr_60 df3_1-df3_60 df7_1-df7_60 i WTP_NPV_3 WTP_NPV_7 Ann_WTP_3 Ann_WTP_7;

RUN;

*reg_compile_6 contains organized results with extra information excluded; Data reg_compile_6;

Set reg_compile_5 (Keep = reg species_econ option WTPreg Ann_WTP_3 Ann_WTP_7);

if option ="numHH" then delete; if reg ="northeast" then delete;

RUN;

%export(reg_compile_6,"&outloc.&output",Results_summary); %export(discounting_out,"&outloc.&output", Discounting_out);

Page 20