Published on :
Statistical CREATION_INTERNE

Covariance Structure Analysis with PROC CALIS

This code is also available in: Deutsch Español Français
Awaiting validation
The script first creates a SAS© COV type dataset (covariance matrix) named 'Wheaton' via a DATA step and datalines. This dataset contains covariances between variables measuring anomie and powerlessness in 1967 and 1971. Then, a first analysis is performed with PROC CALIS and the MSTRUCT statement to model the covariance matrix structure. Fit indices are stored in a 'savefit' dataset and printed. A second PROC CALIS analysis is performed to show an alternative and more compact syntax for defining the same covariance matrix.
Data Analysis

Type : CREATION_INTERNE


Data is created directly in the script via a DATA step with a 'datalines' statement. The 'Wheaton' dataset is a covariance matrix (TYPE=COV).

1 Code Block
DATA STEP Data
Explanation :
This DATA STEP block creates the 'Wheaton' dataset which is a covariance matrix (TYPE=COV). Data is read in free format from embedded data lines (datalines). Labels are associated with variables for better readability.
Copied!
1DATA Wheaton(TYPE=COV);
2 _type_ = 'cov';
3 INPUT _name_ $ 1-11 Anomie67 Powerless67 Anomie71 Powerless71
4 Education SEI;
5 label Anomie67='Anomie (1967)' Powerless67='Powerlessness (1967)'
6 Anomie71='Anomie (1971)' Powerless71='Powerlessness (1971)'
7 Education='Education' SEI='Occupational Status Index';
8 DATALINES;
9Anomie67 11.834 . . . . .
10Powerless67 6.947 9.364 . . . .
11Anomie71 6.819 5.091 12.532 . . .
12Powerless71 4.783 5.028 7.495 9.986 . .
13Education -3.839 -3.889 -3.841 -3.625 9.610 .
14SEI -21.899 -18.831 -21.748 -18.775 35.522 450.288
15;
16RUN;
2 Code Block
PROC CALIS
Explanation :
First execution of PROC CALIS for covariance structure analysis. The MSTRUCT statement is used to specify model variables. The MATRIX statement explicitly defines the parameters of the _COV_ covariance matrix. Fit indices (Chi-square, degrees of freedom, p-value) are requested and saved in the 'savefit' dataset.
Copied!
1PROC CALIS nobs=932 DATA=Wheaton psummary;
2 fitindex on(only)=[chisq df probchi] outfit=savefit;
3 mstruct
4 var = Anomie67 Powerless67 Anomie71 Powerless71;
5 matrix _COV_ [1,1] = phi1,
6 [2,2] = phi2,
7 [3,3] = phi1,
8 [4,4] = phi2,
9 [2,1] = theta1,
10 [3,1] = theta2,
11 [3,2] = theta1,
12 [4,1] = theta1,
13 [4,2] = theta3,
14 [4,3] = theta1;
15RUN;
3 Code Block
PROC PRINT
Explanation :
This simple procedure prints the content of the 'savefit' dataset, which was created by the previous PROC CALIS block and contains the model's fit indices.
Copied!
1PROC PRINT DATA=savefit;
2RUN;
4 Code Block
PROC CALIS
Explanation :
Second execution of PROC CALIS which illustrates a more concise specification method for the covariance matrix. Instead of defining each element one by one, this syntax fills the lower triangular matrix row by row. The fitted model is identical to the previous one.
Copied!
1PROC CALIS nobs=932 DATA=Wheaton psummary;
2 mstruct
3 var = Anomie67 Powerless67 Anomie71 Powerless71;
4 matrix _COV_ [1,1] = phi1 phi2 phi1 phi2,
5 [2, ] = theta1,
6 [3, ] = theta2 theta1,
7 [4, ] = theta1 theta3 theta1;
8 fitindex on(only)=[chisq df probchi];
9RUN;
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.