Help using Base SAS procedures

New to SAS - Two questions on factor analysis proc

Reply
New Contributor
Posts: 2

New to SAS - Two questions on factor analysis proc

Hi All -

I am new to SAS so sorry if my questions are basic and thank you in advance for taking the time. Purely to experiment with the software, I am using a sample data file of random numbers - SampleData.csv - Google Drive

As you can see in this file, the first column lists the observation number (range 1-100), second column is a response variable called 'ResponseVar', followed by 10 columns labeled 'PredictorN' where N=(1,10)

Now in the R software package, I can perform a principal component analysis on the predictor variables to obtain my 10 eigenvalues, a 10x10 rotation matrix of eigenvectors, and my 100x10 transformed matrix. For reference, I obtain this in R with the prcomp function in the stats library.

I am trying to replicate this in SAS University Edition (I'm running thru Oracle's VirtualBox on my MacBook) using the following program:

ods graphics on;

data getdata;

    infile "/folders/myfolders/Sample.csv"

    Firstobs=2 LRECL=1000000000 DLM=',';

    input

    TrialNum ResponseVar Predictor1 Predictor2 Predictor3 Predictor4 Predictor5 Predictor6 Predictor7 Predictor8 Predictor9 Predictor10

    ;

run;

data regressors; set getdata;

    drop TrialNum ResponseVar;

       

/*    Debug code

proc print data=regressors; run;

*/

proc factor data=regressors

    simple corr

    Mineigen=0 /*Retain all factors*/

    All /*Display all optional data*/

    ;

run;

The factor proc step indicates it has read and used 100 records, it calculates the 10 eigenvalues, it generates the 10x10  eigenvectors but it does not generate my 100x10 matrix of transformed data. I suppose I could copy the output of the program and then run a new program to manually generate the transformed data by multiplying each observation by the transpose of the eigenmatrix.

But my questions are:

1) is there a pre-programmed routine to generate the transformed data for the 100 observations in terms of principal components

AND

2) if I wanted to do this manually, is there a way to grab the output of the 'proc factor data=regressors' step so that I can use the eigenvector matrix for computation rather than copying the output, reading into a new program, etc. ?

Thanks again to all in advance.

SAS Employee
Posts: 340

Re: New to SAS - Two questions on factor analysis proc

Hi,

1. Specify out= option on the proc factor statement.

http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_factor_sect0...

2. Specify outstat= option on hte proc factor statemnt, then use proc score. Example here:

SAS/STAT(R) 9.3 User's Guide

New Contributor
Posts: 2

Re: New to SAS - Two questions on factor analysis proc

Posted in reply to gergely_batho

Thank you, sir.

Ask a Question
Discussion stats
  • 2 replies
  • 192 views
  • 0 likes
  • 2 in conversation