To get started, let’s review the syntax and output
to produce a factor analysis of the engineering data (example data
set 1 in
Example data sets). We will use
iterated PAF extraction and ask SAS to extract two factors since the
items in the data generally represent two scales (please note, in
Chapter 3 we will discuss the criteria to determine the number of
factors to extract. The syntax to do this is presented below.
proc factor data = engdata nfactors = 2 method = PRINIT priors = SMC;
var EngProbSolv1 EngProbSolv2 EngProbSolv3 EngProbSolv4
EngProbSolv5 EngProbSolv6 EngProbSolv7 EngProbSolv8
INTERESTeng1 INTERESTeng2 INTERESTeng3 INTERESTeng4
INTERESTeng5 INTERESTeng6;
run;
Since we are at heart
lazy programmers who enjoy shortcuts (where appropriate), we are going
to take a minute to explain two handy shortcuts for referring to a
set of variables that contain the same prefixes: ranges and lists.
Variable ranges require the same prefix and a numeric suffix (e.g., var1
var2 var3
). You can then refer to a set of variables
by the first variable and last variable in the range separated by
a dash (e.g., var1-var3
). Variable lists
require only an identical prefix. The suffix can be numeric or character
(e.g., var011
varXYZ
varABC
).
You can then refer to the set by the common prefix followed by a colon
(e.g., var
:
).
There is another type of range that uses a double dash (e.g., --)
that refers to variables based on position in the data set, but we
do not recommend using that because variable order can change and
you can get yourself in trouble. If we used a range or a list with
the above syntax, this would change our VAR
statement
to the following:
var EngProbSolv1-EngProbSolv8 INTERESTeng1-INTERESTeng6;
*OR;
var EngProbSolv: INTERESTeng: ;
We will use the list
notation to refer to variables throughout the remainder of this book
to reduce and simplify the syntax that we present.