Help With A Factor Analysis Macro (Or Set of Macros)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help With A Factor Analysis Macro (Or Set of Macros)

Feinstein, Zachary
Hello.  Could anyone let me know what I am doing wrong, or perhaps
over-engineering with the following macro:
 
DEFINE !fa (!POS=!CMDEND)

!LET !cnt=""

!DO !var !IN (!1)

!LET !cnt=!CONCAT(!cnt," ")

!IF (!LEN(!cnt)=1) !THEN !LET !arg1=!var

!ELSE

!LET !arg2=!var

FACTOR

 /VARIABLES !arg1 TO !arg2

 /MISSING PAIRWISE

 /ANALYSIS !arg1 TO !arg2

 /PRINT EXTRACTION ROTATION

 /CRITERIA FACTORS(!arg3) ITERATE(25)

 /EXTRACTION PC

 /CRITERIA ITERATE(25)

 /ROTATION VARIMAX

 /METHOD = CORRELATION.

!IFEND

!IF (!LEN(!cnt)=2) !THEN !LET !cnt="" !IFEND

!DOEND

!ENDDEFINE.

 

!fa q506a1 q506a38 2.

 

Basically I am telling the macro to run a Factor Analysis on the
variables q506a1 through q506a38 and I wish it to automatically run a
2-factor solution.  Is the macro already way over-engineered to
accomplish this?  Overall, what am I doing wrong?  Lastly, how could I
re-write the macro to feed it a whole list of non-adjacent variables so
that it automatically just lists them out.  For example, one macro call
might be:

 

!fa var1 var10 var15 2, and other might be:

 

!var var10 TO var15 v20 var25 var30 3

 

Thank you very much.

 

Zachary

[hidden email]