/
Paper 136-27Using SAS Graphics Capabilities to Display Air Quality Dat Paper 136-27Using SAS Graphics Capabilities to Display Air Quality Dat

Paper 136-27Using SAS Graphics Capabilities to Display Air Quality Dat - PDF document

min-jolicoeur
min-jolicoeur . @min-jolicoeur
Follow
414 views
Uploaded On 2015-08-05

Paper 136-27Using SAS Graphics Capabilities to Display Air Quality Dat - PPT Presentation

from the grouping of the stacked bars that the majority ofeach year ID: 101212

from the grouping the

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Paper 136-27Using SAS Graphics Capabilit..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Paper 136-27Using SAS Graphics Capabilities to Display Air Quality DataDebbie Miller, National Park Service, Denver, COABSTRACTSAS software is used to create detailed charts showingair quality data. These charts will be used by state airquality specialists to develop plans to comply with new airquality regulations. SAS/GRAPH from the grouping of the stacked bars that the majority ofeach year’s haziest days at Shenandoah National Parkoccur during the summertime. The use of contrastingcolors on the bars makes it easy to get a qualitative feelfor the relative contributions of the different masscomponents to total light extinction. The abundance ofyellow indicates that sulfates are by far the largestcontributors to extinction. By including three successiveyears on one graph, year to year changes in meanextinction can be seen. It is also apparent from the manyN’s that appear above the bars that a problem existed in1998 with nitrate data collection, resulting in many lostThe second example in Figure 2 illustrates data fromBadlands National Park in South Dakota. The data fromthis park appear quite differently from Shenandoah. Herethe haziest days are distributed throughout the year.to haze during the warmer months, but nitrates becomehighly significant contributors during the winter. UnlikeShenandoah, wintertime extinction values are often higherUSING THE ANNOTATE FACILITYThe bar charts are generated using the GCHARTprocedure. The Annotate facility is used in three places toenhance the basic charts, providing crucial informationabout the data. To use the Annotate facility, a data set isannotations. This data set is then referenced within aCREATING THE CHART LEGENDBelow is a sample of the code used to create theAnnotate data set LEGEND. The sample shown createsthe gray bar and text that show the color assigned tocoarse mass extinction. Similar code is used for each barThe variables X and Y provide the coordinates for theannotations. These are fixed for the first bar drawn;subsequent bars are referenced from the previous bar.The internal variables XLAST and YLAST retain the last Xand Y coordinates used in generating non-text graphicsfor later use by other non-text graphics functions.Similarly, the internal variables XLASTT and YLASTTretain the last X and Y coordinates used in generating textgraphics. Specifying the function MOVE updates XLASTand YLAST to the new X and Y locations given in thatdata line without generating graphics. The value of theFUNCTION variable specifies the annotation to becreated. The value BAR generates a bar drawn fromXLAST, YLAST to the current X, Y values, and the valueLABEL places text at the specified X, Y coordinates.Using the FUNCTION value CNTL2TXT copies the XLASTand YLAST locations to XLASTT and YLASTT withoutgenerating graphics, and thus the location for the textoutput ‘C’ can be given relative to the end of the gray bar.The values of the variables XSYS and YSYS specify thetype of coordinate system used by the X and Y values ofthe annotations. The value ‘1’ specifies an absolutecoordinate system where the X and Y values arepercentages of the data area, and the value ‘7’ specifies arelative coordinate system where units are percentages ofthe data area. This allows the X-axis parameters of thegray bar to fixed, and the X-axis location of the textdescription to be be placed relative to the end of the bar.datalegend;lengthfunctioncolorstyle$8text$12;line0;/*drawcoarsemassbarandtext*/;x=10;y=0.7;;x=14;y=1.4;color='gray80';style='solid';function='label';text='C';color='gray80';style='swissb';size=0.61;position='0';y=0.7;;x=+0.8;text='oarseMass'color='black';style='swissl';size=0.61;x=.;y=0.7;output;The data set LEGEND is referenced in a GSLIDEprocedure statement to create the legend. The bar chartsare later replayed three at a time in a GREPLAYprocedure statement after all individual charts are createdalong with the output of PROC GSLIDE. Letters arehighlighted in the names of the mass types in the legend.These indicate the letter used to flag a data substitution.For example, the ‘i’ in the word ‘Soil’ is displayed in boldbrown; a brown ‘I’ above a bar indicates a substitution forsoil was performed on that particular day.DRAWING LINES TO DEFINE THE SEASONSThe Annotate facility is also used to create the verticallines indicating the boundaries between the calendarquarters. These lines make it easier to visually detectAnnotate data set is created for each year of data fromthe chart data set that contains the extinction values(TEMPEXT2). The data sets are named LINEYYYY,where YYYY is the year (e.g., 1999). The value of thevariable XSYS specifies that the x-axis coordinate systemunits are data values. The internal variable XLAST isupdated by using a MOVE function with a MIDPOINTstatement to retrieve the x-axis location of the current bar.A small amount is then added to the variable X to movethe x-axis location just to the right of the bar.The value of the YSYS variable indicates that thecoordinate system units for the y-axis are percentages ofthe data area. When the last day of March, June, orSeptember is encountered, a data line is added to draw aline from the bottom to the top of the display area byspecifying a starting y-value of 0 and an ending y-value of100. The function DRAW is used to generate the line,and the variable LINE indicates the type of line (dashed).This procedure allows the lines to be generateddynamically for each year of data to be plotted. The codebelow illustrates the creation of the Annotate data sets. dataline&jformatmidpointmmddyy10.;lengthcolor$8;retainwhen'b'line14size0.2hsys'2';settempext2;bysiteyearmonthdate;lastm=last.month;lastd=last.date;xsys='A';x=+0.4ifmonthin(369)thendo;iflastm=1andlastd=1thendo;output;end;end;run;LABELING DATA SUBSTITUTIONSThe Annotate data set BARLABEL is used to identify dayswhere data substitution was performed. During initialprocessing of the extinction data set, a flag is created foreach mass type and set to 1 on each day that substitutionfor that mass type is performed. BARLABEL is createdfrom the chart data set (TEMPEXT2) containing theextinction values. When a flag indicating a substitution isencountered, variables are added to the data set withinstructions for placing the corresponding letter above thebar. The variables X and Y provide the coordinates forthe annotations; the values of the variables XSYS andYSYS specify that the coordinate system units are datavalues. The annotations can thus be automaticallyreferenced to the locations of the stacked bars. The x-axis location is specified by the location of each bar, inthis case the date, using a MIDPOINT statement. The y-axis location of the first letter to be placed above each baris created in an earlier data step, and set to the value ofthe height of the bar +1; successive letters (if necessary)are positioned above the previous letter by adding anincremental value to the y-coordinate (y=y+add). Thevariable FUNCTION specifies that the annotation to becreated is a text label, and the variable TEXT specifies thetext for the label. The data set BARLABEL is laterreferenced from the PROC CHART statement to producethe annotations. The code below shows how thedatabarlabel;formatmidpointmmddyy10.;lengthcolorstyle$8;retainwhen'a'style'duplex'ysys'2'position'2'size0.8hsys'4';settempext2;bysitedate;iffirst=1thenadd=0;subgroup=type;text='';color='black';iftype='ECM'andcmmiss=1thendo;color='gray40';end;iftype='ENO3'andno3miss=1thendo;color='red';end;iftype='EOC'andocmiss=1thendo;color='green';end;iftype='ESOOT'andlacmiss=1thendo;add+0.05*high;end;iftype='ESO4'andso4miss=1thendo;color='gold';end;iftype='ESOIL'andsoilmiss=1thendo;color='lirbr';end;The flexibility of the Annotate facility makes it possible tocreate many types of custom annotations that greatlyenhance basic charts. By creating a program to producethese charts, the process can be automated, allowing forThe charts created by this program will greatly assist stateair quality planners nationwide in their efforts to reduceatmospheric haze.Malm W. C. (1999), , CooperativeState University, Fort Collins, Colorado.SAS Institute, Inc. (1999), Reference, Version 8, Cary, NC: SAS Institute Inc.Sisler J. F., Malm W. C. and Gebhart K. A. (1996), and Seasonal Patterns and Long Term Variability of theComposition of the Haze in the United States: AnAnalysis of Data from the IMPROVE NetworkCooperative Institute for Research in the Atmosphere(CIRA), Colorado State University, Fort Collins, Colorado.U.S. Environmental Protection Agency Office of AirQuality Planning and Standards (2001), Guidance forTracking Progress Under the Regional Haze ProgramACKNOWLEDGMENTSI wish to express my thanks to David Joseph of theNational Park Service for his invaluable comments on thisCONTACT INFORMATIONYour comments and questions are valued andencouraged. Contact the author at:Debbie MillerNational Park Service Air Resources DivisionP.O. Box 25287Denver, CO 80225-0287Work Phone: (303) 987-6947Fax: (303) 969-2822Email: debbie_c_miller@nps.govSAS and all other SAS Institute Inc. product or serviceInstitute Inc. in the USA and other countries. ® indicatesUSA registration.Other brand and product names are registeredtrademarks or trademarks of their respective companies