SPSS Statistics

SPSS Statistics

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

 View Only
Expand all | Collapse all

How can I add new cases with the syntax

  • 1.  How can I add new cases with the syntax

    Posted Fri February 19, 2021 02:57 PM

    It is really a simple question, but I cant seem to find an answer.

    Basically what I want is a compute command that creates a new case instead of a new variable.

    I want to display the percentage of responds to a survey, so I need to add a case for each survey that was sent out, but was not responded to.

    So for example if I have sent out 100 surveys and my dataset contains the 65 answers, so 65 cases. I need to create a variable with 100 cases, which I can change to 1 if answered and to 0 if the rest of the variables are empty.

    However, I dont know how to create new cases via the syntax and I dont want to manually do that every time for much larger datasets than 100 cases.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: How can I add new cases with the syntax
    Best Answer

    Posted Fri February 19, 2021 03:13 PM

    You can't create new cases with COMPUTE. You would use the XSAVE command to write cases conditionally to a new file (see the Command Syntax Reference for details). Then you would use ADD CASES to combine that file with the first one.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: How can I add new cases with the syntax
    Best Answer

    Posted Fri February 19, 2021 03:14 PM

    So there is no way to generate new cases except through a seperate data set?






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: How can I add new cases with the syntax
    Best Answer

    Posted Fri February 19, 2021 03:19 PM

    That is the normal way to do it. You can append cases using the Python plugin, but that is more complicated. You could also generate the new dataset by using DATASET COPY, using SELECT CASES on the copied dataset to select the missing cases, and then using ADD CASES to combine them.






    #SPSSStatistics
    #Support
    #SupportMigration