SPSS Statistics

SPSS Statistics

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

 View Only
  • 1.  How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 06:13 PM

    Hey, can someone please help me with this issue. I am using Mac SPSS v25 and want to do propensity matched scoring but I am getting the following error. Can someone please guide. Thanks a lot

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

    /METHOD=ENTER firstHB SecondHB OtherSecondHB

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

    try:

    spss.Submit(lrcmd)

    except:

    raise ValueError("Logistic Regression step failed")

    fuzzycmd = spssaux.u(r"""FUZZY BY=PropPPM SUPPLIERID=TAVR NEWDEMANDERIDVARS=ID

    GROUP=PPM EXACTPRIORITY=FALSE

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

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

    DELETE VARIABLES %(matchgroup)s.

    DATASET ACTIVATE %(ds)s.

    DELETE VARIABLES %(matchgroup)s.

    DATASET COPY ppmprop.

    DATASET ACTIVATE ppmprop.

    SELECT IF PPM EQ 1.

    DATASET ACTIVATE %(tempdsname)s.

    DATASET ACTIVATE ppmprop.

    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






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 07:46 PM

    If you have not installed the FUZZY extension command, install it using Extensions > Extension Hub menu.

    If you have done that, run this code from a syntax window to get a more detailed error message.

    begin program.

    import FUZZY

    print(FUZZY)

    end program.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 07:52 PM

    I have it installed. Running the above mentioned code gives me the following results.


    begin program.


    import FUZZY


    print(FUZZY)


    end program.

    Traceback (most recent call last):

     File "<string>", line 2, in <module>

    ImportError: No module named FUZZY







    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 08:02 PM

    Are you on Windows with SPSS Statistics installed under Program Files? Windows sometimes plays tricks with files copied under that directory.

    Try starting Statistics using Run As Administrator and installing FUZZY again.

    If that doesn't work, there are some other things to try.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 5.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 08:05 PM

    I actually have Mac - I did try reinstalling FUZZY but same problem.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 6.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 08:05 PM

    I actually have Mac - I did try reinstalling FUZZY but same problem.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 7.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 08:32 PM

    I really appreciate your help Jon, please advice what am I doing wrong ?

    Thanks






    #SPSSStatistics
    #Support
    #SupportMigration


  • 8.  RE: How do I fix problem with propensity score matching?

    Posted Tue August 25, 2020 08:56 PM

    I am not a Mac person, and I don't know exactly how the user in the other post I linked solved it, but one thing that should work is this.

    Create a folder, say /extensions, that you know you have write access to

    Create two environment variables:

    SPSS_CDIALOGS_PATH=/extensions

    SPSS_EXTENSIONS_PATH=/extensions

    Restart Statistics if it was running and try the install again.


    If you don't know how to create environment variables on a Mac, you will have to ask a Mac user about that


    Good luck.






    #SPSSStatistics
    #Support
    #SupportMigration