SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Problems with propension score matching

    Posted Sat March 20, 2021 05:40 PM

    Hi,

    I'm trying to make propension score matching with SPSS v.25 but it doesn't work... It always says:

    * 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 Groupe

    /METHOD=ENTER Age Bili Ascite

    /SAVE=PRED(X).""")

    try:

    spss.Submit(lrcmd)

    except:

    raise ValueError("Logistic Regression step failed")

    fuzzycmd = spssaux.u(r"""FUZZY BY=X SUPPLIERID=ID NEWDEMANDERIDVARS=XX

    GROUP=Groupe EXACTPRIORITY=FALSE

    MATCHGROUPVAR=%(matchgroup)s FUZZ=0.01 DS3=%(tempdsname)s

    /OPTIONS SAMPLEWITHREPLACEMENT=FALSE MINIMIZEMEMORY=TRUE SHUFFLE=FALSE .

    DELETE VARIABLES %(matchgroup)s.

    DATASET ACTIVATE %(ds)s.

    DELETE VARIABLES %(matchgroup)s.

    DATASET COPY XXX.

    DATASET ACTIVATE XXX.

    SELECT IF Groupe EQ 1.

    DATASET ACTIVATE %(tempdsname)s.

    DATASET ACTIVATE XXX.

    ADD FILES /FILE=* /FILE=%(tempdsname)s.

    EXECUTE.

    DATASET CLOSE %(tempdsname)s.""" % locals())

    spss.Submit(fuzzycmd)

    end program.

    >Avertissement n° 6894. Nom de la commande : begin program

    >Arrêt inopiné du programme externe, avec perte de son contenu. Un nouveau

    >programme externe va être lancé pour exécuter le reste du travail.

    >Erreur n° 6887. Nom de la commande : begin program

    >Le programme externe a échoué lors de l'initialisation.

    >L'exécution de cette commande s'arrête.

    Additional error message: create startx process is failure.

    FUZZY extension is installed so I don't understand...

    I'm medical student and so lost in all that...






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: Problems with propension score matching

    Posted Sun March 21, 2021 07:00 PM

    (I hope this gets past the spam blitz.)

    Everything up to the error message in French is just echoing the code from the dialog box. No error message is actually being issued about FUZZY. But the error message in French near the end is reporting that the Python program being run is failing.

    Do you get any output for the logistic regression that is run as the first step in the process?

    Open a syntax window and run this code to see if any Python program can run.

    begin program python3.

    import spss

    print("hello")

    end program.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: Problems with propension score matching

    Posted Thu March 25, 2021 02:33 PM

    No I don't get any output for the logistic regression...

    Python3 seems to be install on the computer but when I try your code it doesn't work...






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: Problems with propension score matching

    Posted Thu March 25, 2021 03:52 PM

    "it doesn't work" doesn't tell me much. What exactly do you see when you run the little program I posted? And what type of computer are you using?






    #SPSSStatistics
    #Support
    #SupportMigration