Chapter3 - Chapter 3 SAS Chapter 3 3.1 Graphs All types...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3 SAS - 1 - Chapter 3 Graphs – All types 3.1 Histograms To illustrate how to graph using SAS, let us consider the grass data set, and the following is a description of the data set: Three seed growth methods are applied to seeds from each of five varieties of turf grass. Six pots are planted with seeds from each method by variety combination. The 90 pots are randomly placed in a uniform growth chamber, and dry matter yields are measured from clippings at the end of four weeks. The variables in the data set are method the growth method variety the variety of turf grass yield the amount of dried turf growth in each pot after four weeks. 1. DATA STEP! data SASdata.grass; input method $ variety @; do i= 1 to 6 ; input yield @; output ; end ; datalines ; A 1 22.1 24.1 19.1 22.1 25.1 18.1 A 2 29.1 17.1 21.6 28.6 17.1 26.6 A 3 25.3 25.8 22.8 28.3 21.3 18.3 A 4 19.8 28.3 26.8 27.3 26.8 26.8 A 5 18.0 15.0 22.0 20.5 26.0 20.5 B 1 13.5 14.5 11.5 6.0 27.0 18.0 B 2 18.9 19.4 12.4 21.4 15.9 17.4 B 3 16.7 10.2 16.7 19.7 18.2 12.2 B 4 15.1 6.5 17.1 7.6 13.6 21.1 B 5 19.8 20.8 16.8 19.3 14.3 12.3 C 1 19.0 22.0 20.0 14.5 19.0 16.0 C 2 22.0 24.0 27.5 18.5 20.0 19.5 C 3 16.4 14.4 21.4 19.9 12.4 21.4 C 4 24.5 16.0 11.0 7.5 14.5 15.5 C 5 10.8 12.3 18.3 6.3 5.8 10.8 ; title2 'List the first 40 observations from grass data set' ; proc print data = SASdata.grass ( obs = 40 ); run ;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 3 SAS - 2 - a. To keep this program compact, I put the six yields for each method by variety combination on a single line. b. Without the @ sign, each time SAS executes an INPUT statement, it goes to a new line a data. The single trailing @ sign is an instruction to hold the line for another INPUT statement in the DATA step. c. Try running this program without the trailing @ sign to see what happens. 2. Some General Notes on Graphing a. All the graphs that are part of SAS program are displayed in a GRAPH window b. Graphics options put these at the TOP of every program!!! goptions reset =all border ftext =swiss gunit =cm htext = 0.6 htitle = 0.8 ; i. RESET= ALL – resets the graphics window; specifically, resets all global statements (such as title, legend,. .) and graphics options ii. BORDER – draws a border around the plot iii. FTEXT=SWISS – font on plot; I have found this to work the best; iv. GUNIT=CM – these are the units the font size is measured in; other common units are PCT and IN v. HTEXT=0.6 height of font vi. HTITLE=0.8 height of the first title line vii. DISPLAY – immediately display plot (default value) 3. Use PROC UNIVARIATE to draw a histogram a. HISTOGRAM statement i. Each variable in the histogram VAR statement will have a histogram created for it. ii. Basic plot – Only add HISTOGRAM statement (1) SAS codes and results: Use Yield with PROC UNIVARIATE for practice. title2 'PROC UNIVARIATE - Illustrating the histogram statement' ; proc univariate data =sasdata.grass; var yield; histogram ; run ;
Background image of page 2
Chapter 3 SAS - 3 - iii. For a better plot – add some options (1) NORMAL option overlays a normal distribution with the sample mean and variances as their corresponding population means and variances (can change by specifying mu=___ and std=___) (2) MIDPOINTS – midpoints for the histogram bars; the more midpoints, the more bars (3) GRID option - adds gridlines at all of the “major” tick marks.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/06/2011 for the course STAT 4360 taught by Professor Park during the Spring '11 term at University of Georgia Athens.

Page1 / 23

Chapter3 - Chapter 3 SAS Chapter 3 3.1 Graphs All types...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online