/*This program calculates the annual peak biomass of Phragmites australis from the PHRAGxCO2xN experiment*/ Data ReadData; infile 'S:\Biogeochemistry\GCREW\0-GCREW Archive\Archived Data\3-Phrag CO2xN\2-Phrag Census Data\ Phrag CO2xN Master Phrag Census 2011-2019 (Published 10-19-2020).csv' dlm=',' firstobs=2; input Year Chamber InOut CO2 Nitrogen Treatment Row$ Column Number TotalHeight Width Flower$ Herbivory$ CutStem$; run; /*The code in this section uses the allometric equations developed by Jon Bakker to calculate the biomass of each stem measured.*/ data PHRAGbiomass; set ReadData; if TotalHeight=-99 then TotalHeight=.; *take out missing values; if TotalHeight=0 then TotalHeight=.; *take out zero values, these data were entered to occupy the columns. i.e. when the census stems were less than 30 stems per quadrat/; if Width=-99 or Width=0 then Width=.; *As explained below, we do not always measure the width. In those cases widths is recorded as '0' in the data file which means it is missing ('.' is SAS).; if InOut=0 then delete; /*These are outside controls, therefore we only calculate the biomass inside the chamber*/ /*From 2011-2015 we measured the height and width of all stems. From 2016 forward we measured width only when stems were > 200 cm tall*/ if Width=. and TotalHeight=. then delete;/*in case there are instances where both parameters are missing for some reason*/ if Width ne . then Phrag_Mass=((0.3151554+0.0065096*(TotalHeight)+0.1600525*(Width)-0.000088606438*(TotalHeight)*(Width))**3); else Phrag_Mass=((0.6263727+0.0091227*(TotalHeight))**3); /*From Ecology data paper, Final version.*/ run; proc export data=PHRAGbiomass (drop=InOut Row Column Number Flower Herbivory CutStem) outfile='S:\Biogeochemistry\GCREW\0-GCREW Archive\Archived Data\3-Phrag CO2xN\1-Biomass (Derived)\1-PHRAGxCO2xN Phragmites Shoot Biomass Data 2011-2019.csv' replace dbms=dlm; delimiter=','; run;