BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
UniformVariance
Calcite | Level 5

I'm trying to use SAS to replicate a principal component analysis in SPSS, but I get different results.

 

The data come from Task 18.4 in Chapter 18 of this website:

 

http://milton-the-cat.rocks/home/dsus_alex.html

 

I have attached both the SPSS and the SAS data files for this analysis.

 

I used the following code in SAS:

 

proc factor
     data = z1
          n = 3;
     ods output FactorPattern = z2;
run;

 

 

 

Here is the Factor Pattern matrix that I get.  I sorted the results by Factor1 in descending order.

 

 

LabelFactor1Factor2Factor3
Dramatic0.83152-0.004010.20573
Manipulative0.759240.159460.15446
Arrogant0.668080.14868-0.05109
Eccentric0.478070.411970.12763
Mistrustful0.131970.702290.29149
Passive-Agressive-0.113450.52411-0.35355
Volatile-0.241190.570740.50051
Perfectionist-0.319970.00441-0.06086
Detached-0.344260.59224-0.47549
Dependent-0.40245-0.24190.6669
Cautious-0.739110.272810.25414

 

Here is the rotated component matrix from SPSS.

 

pca rotated component matrix.png

 

 

As you can see, there is no exact match.  Furthermore, some of the values are entirely different.  Why is that?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

PROC FACTOR documentation:

https://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=statug&docsetTarget=statug_fa...

 

Use the ROTATE= option

 

Although at that point, I don't know if the rotated factors from SAS will match the rotated factors from SPSS.

--
Paige Miller

View solution in original post

9 REPLIES 9
Ksharp
Super User

That is factor analysis ,NOT principal component analysis, Try  PRINCOMP Procedure .

UniformVariance
Calcite | Level 5

1) Doesn't PROC FACTOR perform PCA?

 

https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_factor_sect...

 

 

2) I searched "PROC PRINCOMP vs PROC PCA" on Google, but I don't see any results.  How do they differ?

 

Ksharp
Super User

That is factor analysis ,NOT principal component analysis, Try PRINCOMP Procedure

PaigeMiller
Diamond | Level 26

I think PROC FACTOR defaults to principal components analysis when you use it that way.

 

You can't compare rotated components to un-rotated components.

--
Paige Miller
UniformVariance
Calcite | Level 5

Ah - thanks, Paige.  How, then, do I get the rotated components?

PaigeMiller
Diamond | Level 26

PROC FACTOR documentation:

https://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=statug&docsetTarget=statug_fa...

 

Use the ROTATE= option

 

Although at that point, I don't know if the rotated factors from SAS will match the rotated factors from SPSS.

--
Paige Miller
UniformVariance
Calcite | Level 5

That worked!  Thanks, Paige!

 

ods exclude all;
proc factor
	data = z1
		n = 3
		rotate = varimax;
	ods output OrthRotFactPat = z2;
run;
ods exclude none;



proc sort
	data = z2
		out = z3 (drop = variable);
	by descending 
		factor1;
run;



proc print
	data = z3 noobs;
run;
LabelFactor1Factor2Factor3
Dramatic0.83344-0.01713-0.19708
Manipulative0.785430.08145-0.04691
Arrogant0.67687-0.045480.10403
Eccentric0.549090.29880.1542
Mistrustful0.271230.681130.24104
Passive-Agressive-0.053570.170090.61706
Volatile-0.099840.790070.0159
Detached-0.279160.181040.76462
Perfectionist-0.31870.020750.06406
Dependent-0.379950.33545-0.63903
Cautious-0.659330.499850.02697
ballardw
Super User

And depending on the particular procedure you can get slightly different results inside the same system by changing the order of variables on model statements.

 

When I worked in an SPSS shop we had on process that we worked with to identify key elements. After we got a candidate list the approach had us change the order of variables several times because several of the variables would usually change levels of "importance" depending on which position in the code they occupied

(not role but position:

model y = a b c d e ; would yield different results for the variables than model y= c d e a b;  to use SAS generic code)

 

 

PaigeMiller
Diamond | Level 26

@ballardw wrote:

And depending on the particular procedure you can get slightly different results inside the same system by changing the order of variables on model statements.


This is not true for Principal Components Analysis in SAS. Although I have never done PCA in SPSS, there is nothing the PCA algorithm that was would cause an order of variable dependency, so I can't imagine any correctly programmed PCA algorithm to produce order effects, other than perhaps round-off error in the last decimal places.

 

Example:

title "ORDER OF VARIABLES: Age Height Weight";
proc princomp data=sashelp.class;
	var age height weight;
run;

title "ORDER OF VARIABLES: Weight Height Age";
proc princomp data=sashelp.class;
	var weight height age;
run;
--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 1795 views
  • 2 likes
  • 4 in conversation