Published on :
Statistical CREATION_INTERNE

Exam Score Correlation Analysis

This code is also available in: Deutsch Español Français
Awaiting validation
This SAS© script begins by creating a work table named 'EXAM' containing binary responses (0 or 1) to 8 questions for a set of subjects, entered manually via the DATALINES statement. A second DATA step creates the 'prob5_2' table by calculating the raw score ('raw_score') as the sum of questions Q1 to Q8. Finally, the CORR procedure is used to calculate the correlations between each individual question and the calculated total score.
Data Analysis

Type : CREATION_INTERNE


Data is statically generated within the code using the DATALINES statement.

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'EXAM' table by reading data included in the script (DATALINES). 8 numeric variables (Q1 to Q8) are read with a width 1 format.
Copied!
1DATA EXAM;
2 INPUT (Q1-Q8)(1.);
3 
4DATALINES;
510101010
611111111
711110101
801100000
911110001
1011111111
1111111101
1211111101
1310110101
1400010110
15;
2 Code Block
DATA STEP Data
Explanation :
Creation of the 'prob5_2' table from 'EXAM'. Calculation of a new variable 'raw_score' representing the sum of variables Q1 to Q8 for each observation.
Copied!
1DATA prob5_2;
2 SET EXAM;
3 raw_score = sum (of Q1-Q8);
4RUN;
3 Code Block
PROC CORR
Explanation :
Execution of the CORR procedure to analyze correlation. The 'nosimple' option suppresses simple descriptive statistics. The 'with' statement specifies that the correlation of 'raw_score' with the variables listed in 'var' (Q1-Q8) is desired.
Copied!
1PROC CORR nosimple;
2 title 'Problem 5.2';
3 var Q1-Q8;
4 with raw_score;
5RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.