Producing Charts to Summarize Variables |
The examples in this section use one input file(footnote 1) and one SAS data set. The input file contains the enrollment and exam grades for an introductory chemistry course. The 50 students enrolled in the course attend several lectures, and a discussion section one day a week. The input file has the following structure:
Abdallah F Mon 46 Anderson M Wed 75 Aziz F Wed 67 Bayer M Wed 77 Bhatt M Fri 79 Blair F Fri 70 Bledsoe F Mon 63 Boone M Wed 58 Burke F Mon 63 Chung M Wed 85 Cohen F Fri 89 Drew F Mon 49 Dubos M Mon 41 Elliott F Wed 85 ...more data lines... Simonson M Wed 62 Smith N M Wed 71 Smith R M Mon 79 Sullivan M Fri 77 Swift M Wed 63 Wolfson F Fri 79 Wong F Fri 89 Zabriski M Fri 89
The input file contains the following values from left to right:
The following program creates the GRADES data set that this section uses:
options pagesize=60 linesize=80 pageno=1 nodate; data grades; infile 'your-input-file'; input Name & $14. Gender : $2. Section : $3. ExamGrade1 @@; run;
proc print data=grades; title 'Introductory Chemistry Exam Scores'; run;
Note: Most output in this section uses an OPTIONS statement that specifies PAGESIZE=40 and LINESIZE=80. Other examples use an OPTIONS statement with a different line size or page size to make a chart more readable. When the PAGESIZE= and LINESIZE= options are set, they remain in effect until you reset the options with another OPTIONS statement, or you end the SAS session.
A Listing of the GRADES Data Set
Introductory Chemistry Exam Scores 1 Exam Obs Name Gender Section Grade1 1 Abdallah F Mon 46 2 Anderson M Wed 75 3 Aziz F Wed 67 4 Bayer M Wed 77 5 Bhatt M Fri 79 6 Blair F Fri 70 7 Bledsoe F Mon 63 8 Boone M Wed 58 9 Burke F Mon 63 10 Chung M Wed 85 11 Cohen F Fri 89 12 Drew F Mon 49 13 Dubos M Mon 41 14 Elliott F Wed 85 15 Farmer F Wed 58 16 Franklin F Wed 59 17 Freeman F Mon 79 18 Friedman M Mon 58 19 Gabriel M Fri 75 20 Garcia M Mon 79 21 Harding M Mon 49 22 Hazelton M Mon 55 23 Hinton M Fri 85 24 Hung F Fri 98 25 Jacob F Wed 64 26 Janeway F Wed 51 27 Jones F Mon 39 28 Jorgensen M Mon 63 29 Judson F Fri 89 30 Kuhn F Mon 89 31 LeBlanc F Fri 70 32 Lee M Fri 48 33 Litowski M Fri 85 34 Malloy M Wed 79 35 Meyer F Fri 85 36 Nichols M Mon 58 37 Oliver F Mon 41 38 Park F Mon 77 39 Patel M Wed 73 40 Randleman F Wed 46 41 Robinson M Fri 64 42 Shien M Wed 55 43 Simonson M Wed 62 44 Smith N M Wed 71 45 Smith R M Mon 79 46 Sullivan M Fri 77 47 Swift M Wed 63 48 Wolfson F Fri 79 49 Wong F Fri 89 50 Zabriski M Fri 89
You can create bar charts with this data set to do the following:
FOOTNOTE 1: See the Data Set YEAR_SALES for a complete listing of the input data.
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.