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.
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!
data prob5_2;
set EXAM;
raw_score = sum (of Q1-Q8);
run;
1
DATA prob5_2;
2
SET EXAM;
3
raw_score = sum (of Q1-Q8);
4
RUN;
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!
proc corr nosimple;
title 'Problem 5.2';
var Q1-Q8;
with raw_score;
run;
1
PROC CORR nosimple;
2
title 'Problem 5.2';
3
var Q1-Q8;
4
with raw_score;
5
RUN;
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.