%let drive = H:\SESUG_SUGI\SESUG06; proc catalog cat=gseg kill= _all_; goptions reset=all; ***************************************** * Get the data from a csv file * * Check simple stats * *****************************************; data junk; infile "&drive\Baseline.csv" dlm=',' dsd missover firstobs=3; input col1 $ Tair Tlagoon NH3_flux L10flux F_ton Lfluxold A_F Lflux Diff; t+1; if diff<0 then diff=0; label Lflux="log10(A*flux/(tons wt))"; label Lfluxold="log10(flux/(tons wt)) no area adj."; if _n_=1 then farm = "Stokes"; Moore=0; L2 = lag2(col1); if L2="Moore" then farm="Moore "; if Farm="Moore" then Moore=1; retain farm Moore; proc means; data Ammonia; set junk; if t<3748; tt+1; ** reset when you go to new farm or campaign **; if col1='0:00' then tt=1; time = (tt-1 - 96*floor((tt-1)/96))/4; If time = 0 then group+1; DeltaA_L = Tair-Tlagoon; Label DeltaA_L="Air temp - Lagoon"; Hotair = Max(DeltaA_L,0); Label Hotair="D*(D>0), D=Tair-Tlagoon"; if farm = "Moore" then do; Color = 1; if hotair>0 then color= 3; end; if farm = "Stokes" then do; color = 2; if hotair>0 then color=4; end; label color = "Farm, hot air"; format tair tlagoon l10flux lflux 10.6; ML = Moore*Lflux; MH = Moore*Hotair; run; *************************************** * Format to indicate farm & air vs. * * lagoon temperatures * ***************************************; proc format; value farm 4="Stokes, hot air" 2="Stokes" 3="Moore hot air" 1="Moore"; ************************ * GRAPHICS * ************************; proc gplot data=ammonia; title H=1.5 "Ammonia flux data "; plot Lflux*Tlagoon=color / haxis=axis1 vaxis=axis2 href=0; axis1 major=(number=5); axis2 major=(number=5) label=(angle=90 font=centb h=1.2); symbol1 v=circle c=black h=0.5 i=rl; symbol2 v=circle c=red h=0.5 i=rl; symbol3 v=plus c=green h=0.5 i=rl; symbol4 v=plus c=blue h=0.5 i=rl; format color farm.; proc gplot data=ammonia; plot Lflux*T=color Lflux*tair=color Lflux*DeltaA_L=color Lflux*deltaA_L=farm /haxis=axis1 vaxis=axis2 href=0; symbol1 v=circle c=black h=0.5 i=none; symbol2 v=circle c=red h=0.5 i=none; symbol3 v=plus c=green h=0.5 i=none; symbol4 v=plus c=blue h=0.5 i=none; format color farm.; proc autoreg data=Ammonia; model Lflux = Moore tlagoon hotair ML MH/nlag=10 backstep; output out=out1 predicted=p residual=r; proc gplot; plot (Lflux P)*tlagoon/overlay; symbol1 v=plus c=red; symbol2 v=circle c=black h=.5; proc g3d; scatter hotair*tlagoon=p/ shape="balloon" size=0.5 tilt=85 rotate=45 noneedle; label p=p; label hotair="d"; proc reg data=ammonia; model Lflux = Moore tlagoon hotair; output out=out2 predicted = p r=r; run; quit;