|
|
I am using SPSS version 23 though I must access it over a network at work. I have a dataset with cases and controls that are indicated via variable called "Group" (1 is a case, 2 is a control).
I attempted to run Propensity Score Matching via the SPSS menu. Then I executed the command but I had the following (sorry for the length) message in my log:
* Propensity Score Matching.
begin program.
import spss, random, spssaux, codecs
try:
import FUZZY
except:
print "This procedure requires the FUZZY extension command which is not installed."
parts = [int(i) for i in FUZZY.__version__.split(".")]
if parts < [1,3,0]:
raise EnvironmentError("This procedure requires version 1.3.0 or later of FUZZY")
ds = spss.ActiveDataset()
if ds =="*":
ds = "D" + str(random.random())
spss.Submit("DATASET NAME " + ds)
ds = codecs.encode(ds) # must use code page rep here
matchgroup = "M" + str(random.random()) #temporary variable
tempdsname = "D" + str(random.random())
lrcmd = spssaux.u(r"""LOGISTIC REGRESSION VARIABLES GROUP
/METHOD=ENTER TestAge MEDHT MEDWT MEDBMI MEDABD_CIRC MEDCOMPOSITE_SCORE SBP DBP CHOLRESULT HDLRESULT LDLRESULT groupw ATP3RACE
/SAVE=PRED(PROP_SCORE).""")
try:
spss.Submit(lrcmd)
except:
raise ValueError("Logistic Regression step failed")
fuzzycmd = spssaux.u(r"""FUZZY BY=PROP_SCORE SUPPLIERID=SUBJ_ID NEWDEMANDERIDVARS=Match_ID
GROUP=GROUP EXACTPRIORITY=FALSE
MATCHGROUPVAR=%(matchgroup)s FUZZ=.2 DS3=%(tempdsname)s
/OPTIONS SAMPLEWITHREPLACEMENT=FALSE MINIMIZEMEMORY=TRUE SHUFFLE=FALSE .
DELETE VARIABLES %(matchgroup)s.
DATASET ACTIVATE %(ds)s.
DELETE VARIABLES %(matchgroup)s.
DATASET COPY PSM_MATCHED.
DATASET ACTIVATE PSM_MATCHED.
SELECT IF GROUP EQ 1.
DATASET ACTIVATE %(tempdsname)s.
DATASET ACTIVATE PSM_MATCHED.
ADD FILES /FILE=* /FILE=%(tempdsname)s.
EXECUTE.
DATASET CLOSE %(tempdsname)s.""" % locals())
spss.Submit(fuzzycmd)
end program.
This procedure requires the FUZZY extension command which is not installed.
Traceback (most recent call last):
File "<string>", line 7, in <module>
NameError: name 'FUZZY' is not defined
I checked Utilities > Extensions Installed and it says I have the FUZZY extension version 1.4.7 installed. Why do I get the error FUZZY extension not installed? Perhaps I have some issue with this being an SPSS network version?
Many thanks to anyone offering assistance.
|