SURVEYSELECT
procedure, as we did for
an example in the previous chapter. The code to produce our two subsamples
is presented and described below.
*Sample 1; proc surveyselect data = sdqdata method = SRS n = 500 out = sdqdata_ss1 seed = 37; run; *Sample 2; proc surveyselect data = sdqdata method = SRS n = 500 out = sdqdata_ss2 seed = 62; run;
DATA
argument
specifies the input data set to sample records from; the METHOD
argument
specifies the method of sampling (note that we use simple random sampling
without replacement above); the N
argument
specifies the number of records to include in our subsample; the OUT
argument
specifies the name of the data set to contain the subsample; and the SEED
option
sets the seed to our random number so that we can rerun this code
and get the same subsample.
proc factor data = sdqdata_ss1 nfactors = 3 method = ml rotate = OBLIMIN fuzz=.3; VAR Math: Par: Eng:; run;
Var:
|
Sample 1
|
Sample 2
|
Squared Differences
|
||||||
---|---|---|---|---|---|---|---|---|---|
Comm
|
Factor Loadings
- - (1) - - (2) - -
(3) - -
|
Comm
|
Factor Loadings
- - (1) - - (2) - -
(3) - -
|
||||||
Eng1
|
.61
|
.77
|
.69
|
.83
|
.0038
|
||||
Eng2
|
.65
|
.82
|
.67
|
.84
|
.0006
|
||||
Eng3
|
.75
|
.86
|
.68
|
.82
|
.0018
|
||||
Eng4
|
.48
|
-.68
|
.49
|
-.66
|
.0006
|
||||
Math1
|
.78
|
.90
|
.75
|
.87
|
.0010
|
||||
Math2
|
.75
|
.87
|
.81
|
.90
|
.0007
|
||||
Math3
|
.77
|
.87
|
.74
|
.86
|
.0002
|
||||
Math4
|
.47
|
-.65
|
.38
|
-.61
|
.0019
|
||||
Par1
|
.54
|
.73
|
.50
|
.70
|
.0008
|
||||
Par2
|
.42
|
-.67
|
.49
|
-.73
|
.0033
|
||||
Par3
|
.63
|
.79
|
.73
|
.85
|
.0041
|
||||
Par4
|
.38
|
-.53
|
.36
|
-.55
|
.0002
|
||||
Par5
|
.59
|
.76
|
.49
|
.69
|
.0045
|
||||
Eigen:
|
3.58
|
2.12
|
2.11
|
3.49
|
2.45
|
1.85
|
|||
Note: Loadings less than 0.30 were suppressed to highlight pattern. Pattern coefficients were reported. |
**Conduct EFA Analyses; *ODS output system used to output pattern matrix; ods output ObliqueRotFactPat=SS1_pattern1; proc factor data = sdqdata_ss1 nfactors = 3 method = ml rotate = OBLIMIN fuzz=.3; VAR Math: Par: Eng:; run; ods output ObliqueRotFactPat=SS2_pattern1; proc factor data = sdqdata_ss2 nfactors = 3 method = ml rotate = OBLIMIN fuzz=.3; VAR Math: Par: Eng:; run; ods output close; **Rename output variables so they have unique names and can be merged together. Note the variables with an Fz prefix in the output data set are the results with the Fuzz option employed (suppressing item loadings < .3); data SS1_pattern2 (keep=Variable Fz: rename=(FzFactor1=SS1_Fact1 FzFactor2=SS1_Fact2 FzFactor3=SS1_Fact3)); set SS1_pattern1; run; data SS2_pattern2 (keep=Variable itemN Fz: rename=(FzFactor1=SS2_Fact1 FzFactor2=SS2_Fact2 FzFactor3=SS2_Fact3)); set SS2_pattern1; run; *Sort data sets by the variable they will be merged by; proc sort data=SS1_pattern2; by Variable; run; proc sort data=SS2_pattern2; by Variable; run; *Merge and calculate squared differences; data compare_pattern; merge SS1_pattern2 SS2_pattern2; by Variable; *create new variables containing absolute values of the factor loadings for use in identifying largest loading; abs_SS1_Fact1=abs(SS1_Fact1); abs_SS1_Fact2=abs(SS1_Fact2); abs_SS1_Fact3=abs(SS1_Fact3); abs_SS2_Fact1=abs(SS2_Fact1); abs_SS2_Fact2=abs(SS2_Fact2); abs_SS2_Fact3=abs(SS2_Fact3); *conditional estimation of squared differences; *remember factor 2 in sample 1 = factor 3 in sample 2 and factor 3 in sample 1 = factor 2 in sample 2; if max(of abs_SS1_Fact:)=abs_SS1_Fact1 and max(of abs_SS2_Fact:)=abs_SS2_Fact1 then squared_diff=(SS1_Fact1-SS2_Fact1)**2; else if max(of abs_SS1_Fact:)=abs_SS1_Fact2 and max(of abs_SS2_Fact:)=abs_SS2_Fact3 then squared_diff=(SS1_Fact2-SS2_Fact3)**2; else if max(of abs_SS1_Fact:)=abs_SS1_Fact3 and max(of abs_SS2_Fact:)=abs_SS2_Fact2 then squared_diff=(SS1_Fact3-SS2_Fact2)**2; run;
Var:
|
Sample 1
|
Sample 2
|
Squared Differences
|
||||
---|---|---|---|---|---|---|---|
Comm
|
Factor Loadings
- - (1) - - - (2) -
-
|
Comm
|
Factor Loadings
- - (1) - - - (2) -
-
|
||||
Eng1
|
.62
|
-.03
|
.80
|
.68
|
.85
|
-.14
|
.0033
|
Eng2
|
.62
|
-.07
|
.81
|
.63
|
.83
|
-.19
|
.0002
|
Eng3
|
.73
|
-.01
|
.86
|
.67
|
.85
|
-.11
|
.0002
|
Eng4
|
.48
|
.09
|
-.72
|
.50
|
-.73
|
.13
|
.0001
|
Math1
|
.76
|
.92
|
-.17
|
.75
|
-.04
|
.88
|
.0018
|
Math2
|
.75
|
.89
|
-.08
|
.79
|
.08
|
.87
|
.0007
|
Math3
|
.78
|
.90
|
-.05
|
.75
|
.00
|
.86
|
.0012
|
Math4
|
.46
|
-.70
|
.05
|
.38
|
.04
|
-.63
|
.0053
|
Par1
|
.05
|
.16
|
.11
|
.10
|
.26
|
.10
|
failed
|
Par2
|
.01
|
-.07
|
-.06
|
.05
|
-.18
|
-.08
|
failed
|
Par3
|
.06
|
.19
|
.10
|
.13
|
.27
|
.16
|
failed
|
Par4
|
.13
|
-.14
|
-.28
|
.13
|
-.30
|
-.13
|
.0004
|
Par5
|
.06
|
.17
|
.14
|
.10
|
.23
|
.15
|
failed
|
Eigen:
|
3.42
|
2.10
|
3.22
|
2.43
|
|||
Note: Maximum loadings by item and sample are highlighted. Pattern coefficients were reported. |
Var:
|
Sample 1 Factor Loadings
|
Sample 2 Factor Loadings
|
Squared Differences
|
||||||
---|---|---|---|---|---|---|---|---|---|
1
|
2
|
3
|
4
|
1
|
2
|
3
|
4
|
||
Eng1
|
.77
|
.81
|
.0016
|
||||||
Eng2
|
.87
|
.86
|
.0001
|
||||||
Eng3
|
.82
|
.78
|
.0014
|
||||||
Eng4
|
-.57
|
.50
|
-.51
|
.66
|
failed
|
||||
Math1
|
.89
|
.87
|
.0005
|
||||||
Math2
|
.86
|
.89
|
.0013
|
||||||
Math3
|
.87
|
.86
|
.0003
|
||||||
Math4
|
-.68
|
-.62
|
.0039
|
||||||
Par1
|
.76
|
.74
|
.0001
|
||||||
Par2
|
-.61
|
-.69
|
.0062
|
||||||
Par3
|
.82
|
.84
|
.0006
|
||||||
Par4
|
-.44
|
.38
|
-.51
|
.0043
|
|||||
Par5
|
.77
|
.71
|
.0035
|
||||||
Eigen:
|
3.66
|
2.12
|
2.14
|
.42
|
3.62
|
2.28
|
1.93
|
.54
|
|
Note: Loadings less than 0.30 were suppressed to highlight pattern. Pattern coefficients were reported. |
Var:
|
Sample 1
|
Sample 2
|
Squared Differences
|
||||||
---|---|---|---|---|---|---|---|---|---|
Comm
|
Factor Loadings
- - (1) - - (2) - -
(3) - -
|
Comm
|
Factor Loadings
- - (1) - - (2) - -
(3) - -
|
||||||
Eng1
|
.80
|
.89
|
.57
|
.67
|
.0479
|
||||
Eng2
|
.77
|
.89
|
.57
|
.77
|
.0139
|
||||
Eng3
|
.84
|
.92
|
.66
|
.71
|
.0417
|
||||
Eng4
|
.41
|
-.56
|
.40
|
.38
|
-.43
|
.0181
|
|||
Math1
|
.79
|
.91
|
.79
|
.90
|
.0001
|
||||
Math2
|
.81
|
.90
|
.78
|
.88
|
.0005
|
||||
Math3
|
.78
|
.87
|
.68
|
.79
|
.0053
|
||||
Math4
|
.34
|
-.47
|
.41
|
-.62
|
.0228
|
||||
Par1
|
.38
|
-.57
|
.46
|
-.56
|
.0000
|
||||
Par2
|
.55
|
.76
|
.45
|
.70
|
.0039
|
||||
Par3
|
.61
|
-.74
|
.49
|
-.67
|
.0062
|
||||
Par4
|
.57
|
.77
|
.61
|
.74
|
.0009
|
||||
Par5
|
.35
|
-.56
|
.43
|
-.64
|
.0069
|
||||
Eigen:
|
3.12
|
2.69
|
2.19
|
3.71
|
2.34
|
1.25
|
|||
Note: Loadings less than 0.30 were suppressed to highlight pattern. Pattern coefficients were reported. |