The script begins by creating a dataset named `SocioEconomics` containing indicators for different localities (Population, School, etc.). Then, it executes the `PROC FACTOR` procedure three times to perform a factor analysis. Each execution uses the maximum likelihood method (`method=ml`) but varies the number of factors to extract (1, 2, then 3), allowing for model comparison. The `heywood` option is used to handle cases where communalities exceed 1.
Data Analysis
Type : CREATION_INTERNE
The `SocioEconomics` data is created directly in the code via a DATA step with a `datalines` statement. It does not come from SASHELP or an external source.
1 Code Block
DATA STEP Data
Explanation : This block creates the `SocioEconomics` table in memory. The data is included directly in the script via the `datalines` statement, a common method for small example datasets.
INPUT Population School Employment Services HouseValue;
3
DATALINES;
4
570012.8250027025000
5
100010.96001010000
6
34008.81000109000
7
380013.6170014025000
8
400012.8160014025000
9
82008.326006012000
10
120011.44001016000
11
910011.533006014000
12
990012.5340018018000
13
960013.7360039025000
14
96009.633008012000
15
940011.4400010013000
16
;
2 Code Block
PROC FACTOR
Explanation : This procedure performs a first factor analysis on the `SocioEconomics` table. `method=ml` specifies the use of the maximum likelihood method. `n=1` constrains the model to extract only one factor. `heywood` allows the process to continue even if a communality is greater than 1.
Copied!
title3 'Maximum Likelihood Factor Analysis with One Factor';
proc factor data=SocioEconomics method=ml heywood n=1;
run;
1
title3 'Maximum Likelihood Factor Analysis with One Factor';
2
PROC FACTOR
3
DATA=SocioEconomics method=ml heywood n=1;
4
RUN;
5
3 Code Block
PROC FACTOR
Explanation : Similar to the previous one, this factor analysis tests a two-factor model (`n=2`) to evaluate whether a more complex structure better explains the data variance.
Copied!
title3 'Maximum Likelihood Factor Analysis with Two Factors';
proc factor data=SocioEconomics method=ml heywood n=2;
run;
1
title3 'Maximum Likelihood Factor Analysis with Two Factors';
2
PROC FACTOR
3
DATA=SocioEconomics method=ml heywood n=2;
4
RUN;
5
4 Code Block
PROC FACTOR
Explanation : This last analysis extends the model to three factors (`n=3`), completing the comparison of factorial models to determine the most relevant underlying structure.
Copied!
title3 'Maximum Likelihood Factor Analysis with Three Factors';
proc factor data=SocioEconomics method=ml heywood n=3;
run;
1
title3 'Maximum Likelihood Factor Analysis with Three Factors';
2
PROC FACTOR
3
DATA=SocioEconomics method=ml heywood n=3;
4
RUN;
5
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.