Is it possible to run a Factor Analysis on a pre-defined correlation matrix? From what I know, if you run PROC FACTOR, the first thing SAS does is create a correlation matrix but since the dataset I have is already the correlation matrix, wouldn't that mess up the whole process?
My code:
Rough outline of code
PROC IMPORT datafile = 'whatever.xlsx' out=a dbms=excel;
run;
data corr(type=corr);
set a;
run;
proc factor data=corr;
...
run;
DISCLAIMER: this may not work on correlation data sets stored in Excel, as there's no standard that I know of for correlation matrices in Excel being formatted/laid out the same as a PROC CORR output data set. You can't know until you try it.
This is a great example of why you should look at the documentation.
A correlation data set (with option TYPE=CORR) is valid input to PROC FACTOR and PROC PRINCOMP. Since your output is from PROC CORR, there should be no issue using it in PROC FACTOR or PROC PRINCOMP. Details are here: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=statug&docsetTarget=statu...
Thanks but I was wondering why I have to compute for a new correlation matrix when my initial dataset is already a correlation matrix. Would the analysis significantly change?
Is there a way where I can import the initial dataset and dictate it's TYPE (CORR) so SAS won't have to compute a new correlation matrix from it?
@lmpsumagpang wrote:
Thanks but I was wondering why I have to compute for a new correlation matrix when my initial dataset is already a correlation matrix. Would the analysis significantly change?
As far as I know, you don't have to compute a new correlation data set if you have PROC CORR output. That's my understanding, and the link I gave seems to say that as well. This is what it says:
The data set created by the CORR procedure is automatically given the TYPE=CORR data set option, so you do not have to specify TYPE=CORR.
Please disregard the proc corr code that I shared in my inquiry.
The original data set that I've imported (from an excel file) is already a correlation matrix. Making a proc factor function will result to SAS making a new correlation matrix out of it which might affect my analysis. Is there a way where I can import the excel file and set it as TYPE=CORR?
Thanks for your immediate response and I appreciate all the help!
Rough outline of code
PROC IMPORT datafile = 'whatever.xlsx' out=a dbms=excel;
run;
data corr(type=corr);
set a;
run;
proc factor data=corr;
...
run;
DISCLAIMER: this may not work on correlation data sets stored in Excel, as there's no standard that I know of for correlation matrices in Excel being formatted/laid out the same as a PROC CORR output data set. You can't know until you try it.
Thank you! It worked fine.
The excel file had the same format and data type as the format using the proc corr statement
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.