Drastically reduce work needed for Factor Analysis with SPSS Macro

SPSS macroSPSS Macros drastically reduce the time needed to run factor analysis and creating summary variables.  In the video below I demonstrate how you can greatly increase the speed at which you analyze your data as well as creating the new variables with summary factor scores.

By running Factor analysis twice (but changing the output) you can make it much easier to create summary variables once you’re happy with your solution!

Video demonstrating SPSS Macro running Factor Analysis

Here is the SPSS macro for Factor analysis:

 
*///////////////.
DEFINE !Factor (Rotate !TOKENS (1)   / Title !Tokens (1)  / Sav  !Tokens (1)  /Varys !CMDEND)
Include "B:\SPSS\Syntax\Output_Off.SPS".
script "B:\SPSS\Scripts\Empty.sbs".

Include "B:\SPSS\Syntax\Show Names.SPS".
FACTOR  /VARIABLES !Varys  /PRINT ROTATION  /FORMAT SORT  /CRITERIA MINEIGEN(1) ITERATE(25)  /EXTRACTION PC 
 /CRITERIA ITERATE(50)   /METHOD=CORRELATION /ROTATION !Rotate  / !Unquote(!SAV).
Script "B:\Scripts\Parse\Clean viewer.sbs" ("Component Transformation Matrix").
Script "B:\Scripts\Parse\Clean viewer.sbs" ("Component Matrix").
script "B:\Scripts\S2\Wrap Rows.sbs".
*Script "B:\Scripts\Factor Flag.SBS".
Script "B:\Scripts\Flag above .45.SBS".
Script "B:\Scripts\Flag above .65.SBS".
Script  "B:\Scripts\Flag above .80.SBS".
Script "B:\Scripts\S2\Right Align Column.SBS".
Script "B:\Scripts\Parse\Clean viewer.sbs" ("Total Variance Explained").

*/ Second run of SPSS Macro *.
Include "B:\Syntax\Show Labels.SPS".
FACTOR  /VARIABLES !Varys  /PRINT ROTATION  /FORMAT SORT  /CRITERIA MINEIGEN(1) ITERATE(25)  /EXTRACTION PC 
 /CRITERIA ITERATE(50)   /METHOD=CORRELATION  /ROTATION !Rotate.
Script "B:\Scripts\Parse\Clean viewer.sbs" ("Component Transformation Matrix").
Script "B:\Scripts\Parse\Clean viewer.sbs" ("Component Matrix").
script "B:\Scripts\S2\Wrap Rows.sbs".
*Script "B:\Scripts\Factor Flag.SBS".
Script "B:\Scripts\Flag above .45.SBS".
Script "B:\Scripts\Flag above .65.SBS".
Script  "B:\Scripts\Flag above .80.SBS".
Script "B:\Scripts\S2\Right Align Column.SBS".
!ENDDEFINE.
*///////////////.
!Factor  Rotate=Varimax   SAV="SAVE REG(ALL)"      Varys=  to  .*/
/*EQUAMAX     QUARTIMAX  VARIMAX  */.

And here is the other SPSS macro which eases creating of a new factor.  It takes a little getting used to but is well worth the effort if you’re doing a lot of factor analysis.

*////////////////.
DEFINE !CreateFac  (NewFac !TOKENS (1) / Label !TOKENS (1)  / Vars=!CMDEND)
Compute !NewFac=Mean(!HEAD(!Vars) !DO !v !IN (!TAIL(!Vars)) , !v !DOEND ).
Format !NewFac (F5.2).
Var Label !NewFac !Label.
exe.
!ENDDEFINE.
*////////////////.
/*!CreateFac  NewFac=Joe Label="Joe Rocks" Vars=Enc_friend Proud Und_wrk_res Eth_Std Job_aligns MissPurp.

Learning Macros | Raynald’s SPSS Tools

This page is a simple introduction to macros. There are several fully (line- by-line) commented examples . Overview of several macro-related …

Programming with SPSS Syntax and Macros – Tarstud.hu

Instead, a SPSS macro could generate the SPSS Syntax for each interactive graph within a loop, substituting a new rating scale variable name per iteration.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.