SPSS Statistics

 View Only
  • 1.  Empty string labeled / declared as missing value

    Posted Tue November 15, 2022 06:47 PM
    Provided that FamSpr_7 and FamSpr_8 are string variables: Is this legal syntax in Statistics V28?

    PRESERVE.
    SET PRINTBACK ON.
    DISPLAY DICTIONARY.
    FREQUENCIES FamSpr_7 FamSpr_8.
    MISSING VALUES FamSpr_7 ("").
    MISSING VALUES FamSpr_8 ("").
    VALUE LABELS FamSpr_7 "" "<empty 7>".
    VALUE LABELS FamSpr_8 "" "<empty 8>".
    DISPLAY DICTIONARY.
    FREQUENCIES FamSpr_7 FamSpr_8.
    RESTORE.

    I get strange results in variable view and incorrect output für FamSpr_8. Two cases have valid (i.e. non-empty) values for FamSpr_7. All cases have an empty string in FamSpr_8.
    What should I tell Statistics in order to get correct FREQUENCIES output for FamSpr_8?



    #SPSSStatistics

    Attachment(s)

    sav
    empty_strings_pre.sav   2 KB 1 version
    sav
    empty_strings_post.sav   2 KB 1 version


  • 2.  RE: Empty string labeled / declared as missing value

    Posted Tue November 15, 2022 06:53 PM
      |   view attached
    The screenshots apparently did not come through. 
    Please see the (hopefully) attached pdf instead.




    Attachment(s)

    pdf
    varview_pre_post.pdf   73 KB 1 version


  • 3.  RE: Empty string labeled / declared as missing value

    IBM Champion
    Posted Tue November 15, 2022 10:29 PM
     For string missing values, there is no difference between an empty string and one that is all blanks, so declaring "" a missing value has the effect of making all blank strings missing.  Maybe that is contributing to this puzzle.

    --





  • 4.  RE: Empty string labeled / declared as missing value

    Posted Tue November 15, 2022 10:34 PM
    Maybe. What baffles me is the numeric missing value for the second string variable. 

    My best guess when I sae that was a corrupted SAV file.

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------



  • 5.  RE: Empty string labeled / declared as missing value

    Posted Wed November 16, 2022 05:03 AM
    By now I also think file corruption might be an explanation. Perhaps I should have mentioned that I created yesterday's data file with pyreadstat.write_sav() (https://github.com/Roche/pyreadstat).

    The syntax below attempts to reproduce the problem from scratch. But the data file generated this way does not show any misbehaviour, neither in in the variable view nor in the viewer. 

    INPUT PROGRAM.
    LOOP id=1 to 1000.
    END CASE.
    END LOOP.
    END FILE.
    END INPUT PROGRAM.
    EXECUTE.

    SAVE OUTFILE = 'empty_strings_2.sav'.
    GET FILE = 'empty_strings_2.sav'.
    DATASET NAME empty_strings_2.
    DATASET ACTIVATE empty_strings_2 WINDOW = FRONT.

    STRING
        all_empty_5
        some_empty_5
        none_empty_5
        (A5)
        all_empty_10
        some_empty_10
        none_empty_10
        (A10).
    EXECUTE.

    COMPUTE all_empty_5 = "".
    COMPUTE some_empty_5 = "".
    COMPUTE none_empty_5 = "text5".
    COMPUTE all_empty_10 = "".
    COMPUTE some_empty_10 = "".
    COMPUTE none_empty_10 = "text10".

    DO IF ID LE 500 .
        COMPUTE some_empty_5 = "text5".
        COMPUTE some_empty_10 = "text10".
    END IF.
     
    EXECUTE.

    VALUE LABELS
        all_empty_5
        some_empty_5
        none_empty_5
        ""
        "<empty_5>".
    VALUE LABELS    
        all_empty_10
        some_empty_10
        none_empty_10
        ""
        "<empty_10>".

    MISSING VALUES 
        all_empty_5
        some_empty_5
        none_empty_5
        all_empty_10
        some_empty_10
        none_empty_10
        ("").

    FREQUENCIES 
        all_empty_5
        some_empty_5
        none_empty_5
        all_empty_10
        some_empty_10
        none_empty_10.


    I don't want to rule out other causes yet, but I think I should bring my observations to the attention of the pyreadstat developer. 

    Thank you very much for your consideration. 





  • 6.  RE: Empty string labeled / declared as missing value

    IBM Champion
    Posted Wed November 16, 2022 09:55 AM
    It's not uncommon for third-party sav files to not be quite right.

    --





  • 7.  RE: Empty string labeled / declared as missing value

    Posted Tue November 15, 2022 08:52 PM
    These are strange results indeed.
    I can't explain it, and my own test case (using DATA LIST to define 2 strings) did not replicate it.

    I wonder if you could enter a missing value, say for instance, "M", and define that as the missing data value, so we can start narrowing down the issue?

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------