The script begins by creating a 'scores' dataset containing six numerical variables. Then, it uses the CALIS procedure three times with slight variations to illustrate different syntaxes and options. The first PROC CALIS block defines a simple factor model. The second block specifies paths more explicitly and customizes fit indices. The third block generates a path diagram to visualize the factor model. The latent factors 'verbal' and 'math' are linked respectively to variables 'x1-x3' and 'y1-y3'.
Data Analysis
Type : CREATION_INTERNE
The 'scores' dataset is created directly within the script via a DATA STEP block and the 'datalines' statement. It contains scores for 32 observations for 6 variables (x1-x3, y1-y3).
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'scores' table by reading embedded data directly into the code using the 'datalines' statement. The table contains 6 numerical variables: x1, x2, x3, y1, y2, y3.
Explanation : This block executes an initial confirmatory factor analysis. The 'factor' statement defines two latent factors: 'verbal' (linked to variables x1 to x3) and 'math' (linked to variables y1 to y3). The 'pvar' statement sets the variance of each factor to 1 for model identification.
Copied!
proc calis data=scores;
factor
verbal ===> x1-x3,
math ===> y1-y3;
pvar
verbal = 1.,
math = 1.;
run;
1
PROC CALISDATA=scores;
2
factor
3
verbal ===> x1-x3,
4
math ===> y1-y3;
5
pvar
6
verbal = 1.,
7
math = 1.;
8
RUN;
3 Code Block
PROC CALIS
Explanation : This second call to PROC CALIS shows an alternative syntax for the 'factor' statement, where each path between the factor and the variable is declared individually. The 'fitindex' option is used to select and display specific model fit indices (Chi-square, RMSEA, SRMR, etc.).
Copied!
title "Basic Confirmatory Factor Model: Separate Path Entries";
title2 "FACTOR Model Specification";
proc calis data=scores;
factor
verbal ===> x1,
verbal ===> x2,
verbal ===> x3,
math ===> y1,
math ===> y2,
math ===> y3;
pvar
verbal = 1.,
math = 1.;
fitindex noindextype on(only)=[chisq df probchi rmsea srmr bentlercfi];
run;
1
title "Basic Confirmatory Factor Model: Separate Path Entries";
Explanation : This third block activates ODS graphics via 'ods graphics on'. PROC CALIS is then called with the 'plots=pathdiagram' option to generate a visual representation of the factor model. The syntax '= 1.' in the 'factor' statement is another way to fix factor loadings for identification. Graphics are then deactivated with 'ods graphics off'.
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.