BookmarkSubscribeRSS Feed
RebeccaB_
Obsidian | Level 7

Hi, 

 

I have a conceptual question about principal component analysis in SAS as compared to R. In R you must write the syntax PRCOMP to manually standardize the input variables. Does SAS automatically do this for you in the PROC FACTOR procedure? 

 

Thank you 

6 REPLIES 6
PaigeMiller
Diamond | Level 26

PROC PRINCOMP, by default, standardizes your variables. Or to say it another way, it works from the correlation matrix from your data. You can override this and use the COV option to work from the covariance matrix.

 

I don't use PROC FACTOR, you should check the documentation, but I believe it is similar.

--
Paige Miller
Reeza
Super User
It does not, you can use PROC STDIZE to standardize the data ahead of time. Standardization requirements may vary slightly depending on the method used...and I'm not sure if you're doing it based on correlation versus covariance matrix if it matters.
RebeccaB_
Obsidian | Level 7

Thank you for your quick response. This is the code I used: 

 

Proc Factor data= data-set-name

out= data-set-name

nfact=37

simple

method=prin

priors=one

mineigen= 0.99

scree

rotate=varimax

round

flag=.40;

var variables-to-be-analyzed

run;

 

So even using METHOD=PRIN that will not standardize our variables to make sure I'm understanding you correctly? 

PaigeMiller
Diamond | Level 26

According to the PROC FACTOR documentation

 

COVARIANCE
COV

requests factoring of the covariance matrix instead of the correlation matrix. The COV option is effective only with the METHOD=PRINCIPAL, METHOD=PRINIT, METHOD=ULS, or METHOD=IMAGE option. For other methods, PROC FACTOR produces the same results with or without the COV option.

So if you don't use the COV option, you get the correlation matrix, which is created using standardized variables.

 

--
Paige Miller
RebeccaB_
Obsidian | Level 7
Okay, to make sure I'm understanding correctly (I'm pretty much self-taught in PCA) because I specified METHOD=PRIN, and I did not use the COV option, that the input variables are standardized. We are using the correlation matrix (which I see in my output) and that is using standardized variables. Is that correct? So I would not need to change my code to make the input variables standardized?
PaigeMiller
Diamond | Level 26

@RebeccaB_ wrote:
Okay, to make sure I'm understanding correctly (I'm pretty much self-taught in PCA) because I specified METHOD=PRIN, and I did not use the COV option, that the input variables are standardized.

Yes

 

We are using the correlation matrix (which I see in my output) and that is using standardized variables. Is that correct? So I would not need to change my code to make the input variables standardized?

 

Yes

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1452 views
  • 6 likes
  • 3 in conversation