daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GET
  2.   FILE='/Users/racheltang/Documents/LKSOM/Y3/Research/CDT Stent Paper/CDT 2005-2013 unmatched database.sav'.
  3. DATASET NAME DataSet1 WINDOW=FRONT.
  4. * Propensity Score Matching.
  5. begin program.
  6. import spss, random, spssaux, codecs
  7. try:
  8.    import FUZZY
  9. except:
  10.    print "This procedure requires the FUZZY extension command which is not installed."
  11. parts = [int(i) for i in FUZZY.__version__.split(".")]
  12. if  parts < [1,3,0]:
  13.    raise EnvironmentError("This procedure requires version 1.3.0 or later of FUZZY")
  14. ds = spss.ActiveDataset()
  15. if ds =="*":
  16.    ds = "D" + str(random.random())
  17.    spss.Submit("DATASET NAME " + ds)
  18. ds = codecs.encode(ds)  # must use code page rep here
  19. matchgroup = "M" + str(random.random())  #temporary variable
  20. tempdsname = "D" + str(random.random())
  21. lrcmd = spssaux.u(r"""LOGISTIC REGRESSION VARIABLES Intervention_angio_stent
  22.      /METHOD=ENTER CM_AIDS CM_ALCOHOL CM_ANEMDEF CM_ARTH CM_BLDLOSS CM_CHF CM_CHRNLUNG CM_COAG CM_DEPRESS CM_DM CM_DMCX CM_DRUG CM_HTN_C CM_HYPOTHY CM_LIVER CM_LYMPH CM_LYTES CM_METS CM_NEURO CM_OBESE CM_PARA CM_PERIVASC CM_PSYCH CM_PULMCIRC CM_RENLFAIL CM_TUMOR CM_ULCER CM_VALVE CM_WGHTLOSS Dysrhythmia Hyperlipidemia
  23.      /SAVE=PRED(xx).""")
  24. try:
  25.    spss.Submit(lrcmd)
  26. except:
  27.    raise ValueError("Logistic Regression step failed")
  28. fuzzycmd = spssaux.u(r"""FUZZY BY=xx SUPPLIERID=ID NEWDEMANDERIDVARS=xxx
  29. GROUP=Intervention_angio_stent EXACTPRIORITY=FALSE
  30. MATCHGROUPVAR=%(matchgroup)s FUZZ=0.1 DS3=%(tempdsname)s
  31. /OPTIONS SAMPLEWITHREPLACEMENT=FALSE MINIMIZEMEMORY=TRUE SHUFFLE=FALSE .
  32. DELETE VARIABLES %(matchgroup)s.
  33. DATASET ACTIVATE %(ds)s.
  34. DELETE VARIABLES %(matchgroup)s.
  35. DATASET COPY xxxx.
  36. DATASET ACTIVATE xxxx.
  37. SELECT IF Intervention_angio_stent EQ 1.
  38. DATASET ACTIVATE %(tempdsname)s.
  39. DATASET ACTIVATE xxxx.
  40. ADD FILES /FILE=* /FILE=%(tempdsname)s.
  41. EXECUTE.
  42. DATASET CLOSE %(tempdsname)s.""" % locals())
  43. spss.Submit(fuzzycmd)
  44. end program.
  45. This procedure requires the FUZZY extension command which is not installed.
  46. Traceback (most recent call last):
  47.   File "<string>", line 7, in <module>
  48. NameError: name 'FUZZY' is not defined
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top