**** Input the CP&L data **********; data cpl; infile "C:\Documents and Settings\dickey\My Documents\Pietrafesa\Miller\cpl.txt" firstobs=2 dsd dlm='09'x missover; input SOURCE LOCALID LATD LATM LOND LONM SAMPDT date9. +1 MONTH YEAR GEAR SPP SL TEMPS TEMPB SALS SALB ; format sampdt date7.; lat = 60*(latd-33)+latm; long =60*(lond-77)+lonm; proc print data=cpl(obs=10); proc summary nway; class year month lat long; var source month year temps tempb sals salb; output out=outcpl n=catch; proc gplot; plot lat*long; proc print data=outcpl; run; **** Input station names, compute lat, long to 0.1 degree ****; data stations; infile "C:\Documents and Settings\dickey\My Documents\Pietrafesa\Miller\stations.txt" firstobs=2 dsd dlm='09'x missover; length name $30.; length colr $7.; input location lat long name $ ; id="AAAAA"; shape = "balloon"; color="black"; latd = floor(lat/10000); latm= floor((lat-10000*latd)/100); lats= lat-10000*latd-100*latm; longd = floor(long/10000); longm= floor((long-10000*longd)/100); longs= long-10000*longd-100*longm; proc print data=stations(obs=10); data stations; set stations; keep name location lat long id shape color; lat = round(latd+latm/60+lats/3600,.1); long = -1*round(longd+longm/60 + longs/3600,.1); proc sort; by location; proc print data=stations(obs=10); data anchors; length color $7.; input lat long name $ color $ ;long=-1*long; nstations=3; id=name; shape="prism"; cards; 35.4 75.6 Buxton black 36.0 76.6 Edenton blue 35.3 75.6 Hatteras cyan 36.1 75.7 Kitty_Hawk gray 35.0 77.0 New_Bern green 33.0 78.0 Southpoint red 35.5 77.2 Washington tan ; proc summary data=stations noprint nway; class lat long; output out=outst n=nstations; id id shape color; var lat; data outst; set outst anchors; proc print data=outst; run; proc g3d data=outst; Title "Location of stations"; scatter lat*long=nstations/shape=shape color=color rotate=10; footnote c=black "Buxton " c=blue "Edenton " c=cyan "Hatteras " c=gray "Kitty Hawk" ; footnote2 c=green "New Bern " c=red "Southpoint " c=tan "Washington "; proc gplot data=outst; plot lat*long = id/nolegend haxis = -84 to - 75; symbol1 v=plus c=black i=none; symbol2 v=dot i=none c=blue; symbol3 v=dot i=none c=black; symbol4 v=dot i=none c=tan; symbol5 v=dot i=none c=gray; symbol6 v=dot i=none c=cyan; symbol7 v=dot i=none c=red; symbol8 v=dot i=none c=green; run; data croaker1; infile "C:\Documents and Settings\dickey\My Documents\Pietrafesa\Miller\croaker.txt" firstobs=2 dsd dlm='09'x missover; input LOCATION STATION $ DATE TIME SPECIES SPSTATUS FREQUENCY LENGTH FORM4 QUALITY2; format date date7.; year=year(date); month=month(date); proc sort; by location; data croaker2; merge croaker1 stations; by location; proc sort; by date; proc print data=croaker2(obs=40); run; proc summary nway data=croaker2; class year month lat long; output out=outcroaker sum=catch; var frequency; id name; data outcroaker; set outcroaker; lcatch=log(catch); xcoord = month + .1*(year-1982); label Xcoord = "Month (year within month)"; label lcatch = "Ln of catch"; proc print data=outcroaker(obs=50); run; proc sort; by id; goptions reset=all; axis1 order = 0 to 9 label = (angle=90); proc gplot data=outcroaker; plot lcatch*xcoord=year/legend vaxis=axis1; where month<7; symbol1 v=dot i=boxt; title "Croaker catch, log scale"; title2 "Variation across locations - color is year"; proc gplot data=outcroaker; plot lcatch*xcoord=year/legend vaxis=axis1; where month>6; proc summary data=outcroaker nway; class lat long; var lcatch; output out=outcroaker2 mean = mnlcatch std=stdlcatch; where 2 34; title3 " Mean ln(catch) over years and months"; footnote c=black "Buxton " c=blue "Edenton " c=cyan "Hatteras " c=gray "Kitty Hawk" ; footnote2 c=green "New Bern " c=red "Southpoint " c=tan "Washington "; proc g3d data=combine; scatter lat*long=stdlcatch/shape=shape color=color rotate=10; where lat > 34; title3 " Std deviation ln(catch) over years and months"; proc sort data=outcroaker2; by descending mnlcatch; proc print data=outcroaker2; var lat long mnlcatch stdlcatch; footnote " " ; title3 "By descending mean of monthly ln(catch)"; run; proc sort data=outcroaker2; by stdlcatch; proc print data=outcroaker2; var lat long mnlcatch stdlcatch; footnote " " ; title3 "By ascending std deviation of monthly ln(catch)"; run;