O'Reilly logo

Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

and various fonts when your site licenses SAS/GRAPH software. You can use PROC
UNIVARIATE to customize the histograms by adding tables with summary statistics
directly on the graphical display. PROC UNIVARIATE also enables you to overlay the
histogram with fitted density curves or kernel density estimates so that you can examine
the underlying distribution of your data.
Input File and SAS Data Set for Examples
The examples in this section use one input file and one SAS data set. For a complete
listing of the input data, see “The YEAR_SALES Data Set” on page 816. 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 student's last name (and first initial if necessary)
the student's gender (F or M)
the day of the week for the student's discussion section (Mon, Wed, or Fri)
the student's first exam grade
The following program creates the GRADES data set that this section uses. This
example shows the first fifteen observations:
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;
options obs=15;
data grades;
input Name &$14. Gender :$2. Section :$3. ExamGrade1 @@;
datalines;
Abdallah F Mon 46 Anderson M Wed 75
Aziz F Wed 67 Bayer M Wed 77
Bhatt M Fri 79 Blair F Fri 70
Input File and SAS Data Set for Examples 553
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 L M Mon 41 Elliott F Wed 85
Farmer F Wed 58 Franklin F Wed 59
Freeman F Mon 79 Friedman M Mon 58
Gabriel M Fri 75 Garcia M Mon 79
Harding M Mon 49 Hazelton M Mon 55
Hinton M Fri 85 Hung F Fri 98
Jacob F Wed 64 Janeway F Wed 51
Jones F Mon 39 Jorgensen M Mon 63
Judson F Fri 89 Kuhn F Mon 89
LeBlanc F Fri 70 Lee M Fri 48
Litowski M Fri 85 Malloy M Wed 79
Meyer F Fri 85 Nichols M Mon 58
Oliver F Mon 41 Park F Mon 77
Patel M Wed 73 Randleman F Wed 46
Robinson M Fri 64 Shien M Wed 55
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
;
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.
554 Chapter 31 Producing Charts to Summarize Variables

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required