An instructor is interested in creating a frequency table of score changes between a pair of tests given in one of his college
courses. The data set Score
contains test scores for his students who took a pretest and a posttest on the same material. The variable ScoreChange
contains the difference between the two test scores. The following statements create the data set:
data Score; input Student $ PreTest PostTest @@; label ScoreChange = 'Change in Test Scores'; ScoreChange = PostTest - PreTest; datalines; Capalleti 94 91 Dubose 51 65 Engles 95 97 Grant 63 75 Krupski 80 75 Lundsford 92 55 Mcbane 75 78 Mullen 89 82 Nguyen 79 76 Patel 71 77 Si 75 70 Tanaka 87 73 ;
The following statements produce a frequency table for the variable ScoreChange
:
title 'Analysis of Score Changes'; ods select Frequencies; proc univariate data=Score freq; var ScoreChange; run;
The ODS SELECT statement restricts the output to the “Frequencies” table; see the section ODS Table Names. The FREQ option on the PROC UNIVARIATE statement requests the table of frequencies shown in Output 4.4.1.
Output 4.4.1: Table of Frequencies
Analysis of Score Changes |
Frequency Counts | |||
---|---|---|---|
Value | Count | Percents | |
Cell | Cum | ||
-37 | 1 | 8.3 | 8.3 |
-14 | 1 | 8.3 | 16.7 |
-7 | 1 | 8.3 | 25.0 |
-5 | 2 | 16.7 | 41.7 |
-3 | 2 | 16.7 | 58.3 |
2 | 1 | 8.3 | 66.7 |
3 | 1 | 8.3 | 75.0 |
6 | 1 | 8.3 | 83.3 |
12 | 1 | 8.3 | 91.7 |
14 | 1 | 8.3 | 100.0 |
From Output 4.4.1, the instructor sees that only score changes of and occurred more than once.
A sample program for this example, uniex03.sas, is available in the SAS Sample Library for Base SAS software.