Programming the statistical procedures from SAS

obtaining the principal components from proc princomp

Accepted Solution Solved
Reply
Super Contributor
Posts: 412
Accepted Solution

obtaining the principal components from proc princomp

Hi,

 

I have been using proc princomp to perform a principal components analysis. It gave me the eigen vectors, but not the principal components of the original data. Is it possible to transform the original data in order to get the princpal components and later use them in a regression?

 

Thank you


Accepted Solutions
Solution
‎03-11-2017 07:19 PM
SAS Super FREQ
Posts: 3,307

Re: obtaining the principal components from proc princomp

If you look at the Getting Started example in the PROC PRINCOMP documentation, you will see that 

the eigenvectors are listed in the "Eigenvectors" table. They are named Prin1, Prin2, Prin3, etc.

You can use the OUTSTAT= option on the PROC PRINCOMP statement to create an output data set that contains the eigenvectors.

They are listed as the rows that are labeled PRIN1, PRIN2, etc.

 

If you want to use the PCs in a regression, I believe you want to use the SCORES, which are available in the OUT= data set.

 

View solution in original post


All Replies
Grand Advisor
Posts: 16,893

Re: obtaining the principal components from proc princomp

What does your code look like?

Can we assume you've tried the standard output datasets and they don't have the values? 

Grand Advisor
Posts: 9,452

Re: obtaining the principal components from proc princomp

Check this out.

http://blogs.sas.com/content/iml/2014/11/07/distribution-of-blood-types.html
Solution
‎03-11-2017 07:19 PM
SAS Super FREQ
Posts: 3,307

Re: obtaining the principal components from proc princomp

If you look at the Getting Started example in the PROC PRINCOMP documentation, you will see that 

the eigenvectors are listed in the "Eigenvectors" table. They are named Prin1, Prin2, Prin3, etc.

You can use the OUTSTAT= option on the PROC PRINCOMP statement to create an output data set that contains the eigenvectors.

They are listed as the rows that are labeled PRIN1, PRIN2, etc.

 

If you want to use the PCs in a regression, I believe you want to use the SCORES, which are available in the OUT= data set.

 

Super Contributor
Posts: 412

Re: obtaining the principal components from proc princomp

Thanks Rick, when I added "out = new_data" I obtained a data table which contains the original variables and the newly calculated principal components.

 

Could I now use these Principal Components in a regression? I have a IML code which does the Principal Components Analysis, but for some reason standardizes the Principal Components - but the PC's that I obtained above are not standardized, so I just want to make sure that these non standardized PCs are the ones that I should use in a regression.

 

 

Thanks 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 104 views
  • 1 like
  • 4 in conversation