1 / 35

Chapter 15

Chapter 15. Introduction to Graphics. Section 15.1. Producing Bar and Pie Charts. Objectives. Produce high-resolution bar and pie charts. Control the statistics displayed in the chart. Graphically Summarizing Data. You can use bar or pie charts to graphically display the following:

louvain
Download Presentation

Chapter 15

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 15 Introduction to Graphics

  2. Section 15.1 Producing Bar and Pie Charts

  3. Objectives • Produce high-resolution bar and pie charts. • Control the statistics displayed in the chart.

  4. Graphically Summarizing Data • You can use bar or pie charts to graphically display the following: • distribution of a variable’s values • average value of a variable for different categories • total value of a variable for different categories

  5. Vertical Bar Chart

  6. Horizontal Bar Chart

  7. Pie Chart

  8. Specifying a Chart • When you use the GCHART procedure, perform the following tasks: • specify the physical form of the chart • identify a chart variable that determines the number of bars or pie slices to create • optionally identify an analysis variable to use for calculating statistics that determine the height (or length) of the bar or the size of the slice • By default, the height, length, or size represents a frequency count (N).

  9. The GCHART Procedure • General form of the PROC GCHART statement: • Use one of these statements to specify the desired type of chart: PROC GCHART DATA=SAS-data-set; HBAR chart-variable . . . </options>; VBAR chart-variable . . . </options>; PIE chart-variable . . . </options>;

  10. Chart Variable • The chart variable • determines the number of bars or slices produced within a graph • can be character or numeric.

  11. Vertical Bar Chart • Produce a vertical bar chart that displays the number of employees in each job code. proc gchart data=ia.crew; vbar JobCode;run; JobCodeis the chart variable.

  12. Vertical Bar Chart

  13. Horizontal Bar Chart Produce a horizontal bar chart that displays the number of employees in each job code. proc gchart data=ia.crew; hbar JobCode;run; JobCodeis the chart variable.

  14. Horizontal Bar Chart

  15. Pie Chart Produce a pie chart that displays the number of employees in each job code. proc gchart data=ia.crew; pie JobCode;run; JobCodeis the chart variable.

  16. Pie Chart

  17. Character Chart Variable • If the chart variable is character, a bar or slice is created for eachuniquevariable value. • The chart variable is JobCode.

  18. Numeric Chart Variable • For numeric chart variables, the variables are assumed to be continuousunless otherwise specified. • Intervals are automatically calculated and identified by midpoints. • One bar or slice is constructed for each midpoint.

  19. Numeric Chart Variable • Produce a vertical bar chart on the numeric variable Salary. proc gchart data=ia.crew; vbar Salary;run; Salaryis the chart variable.

  20. Numeric Chart Variable

  21. The DISCRETE Option • To override the default behavior for numeric chart variables, use the DISCRETEoption in the HBAR, VBAR, or PIE statement. • The DISCRETEoption produces a bar or slice for each unique numeric variable value; the values are no longer treated as intervals.

  22. Numeric Chart Variable Produce a vertical bar chart that displays a separate bar for each distinct value of the numeric variable Salary. • Salary is the chart variable,but theDISCRETEoption modifies how the values are displayed. proc gchart data=ia.crew; vbar Salary / discrete;run;

  23. The DISCRETE Option

  24. Summary Statistic • By default, the statistic that determines the length or height of each bar or size of pie slice is a frequency count (N).

  25. Analysis Variable • To override the default frequency count, you can use the following HBAR, VBAR, or PIE statement options: SUMVAR=analysis-variable TYPE=MEAN | SUM

  26. SUMVAR= and TYPE= Options • If an analysis variable is specified, the default value of TYPE is SUM. • If an analysis variable is not specified, the default value of TYPE is FREQ.

  27. Using an Analysis Variable • Produce a vertical bar chart that displays the average salary of employees in each job code. proc gchart data=ia.crew; vbar JobCode / sumvar=Salary type=mean;run;

  28. GCHART Output

  29. RUN-Group Processing • PROC GCHART supports RUN-group processing, which means that • the procedure executes the group of statements following the PROC statement when a RUN statement is encountered • additional statements followed by another RUN statement can be submitted without resubmitting the PROC statement • the procedure stays active until a PROC, DATA, or QUIT statement is encountered.

  30. Pie Chart Produce a pie chart that displays the total salary of employees in each job code. proc gchart data=ia.crew; pie JobCode / sumvar=Salary type=sum; format Salary dollar8.; run;

  31. Pie Chart

  32. Pie Chart • You can use the FILL= option to specify whether to fill the pie slices in a solid (FILL=S) or crosshatched (FILL=X) pattern. pie JobCode / sumvar=Salary type=sum fill=x; format Salary dollar8.; run;

  33. Pie Chart

  34. Exploding a Pie Slice • You can highlight individual slices of a pie chart by moving them away from the rest of the pie with the EXPLODE= option. pie JobCode / sumvar=Salary type=sum fill=x explode='PILOT3'; format Salary dollar8.; run;quit;

  35. Exploding a Pie Slice

More Related