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 do I produce a frequency table that includes a count of zero for empty cells?

  • 1.  How do I produce a frequency table that includes a count of zero for empty cells?

    Posted Fri June 11, 2021 07:08 PM

    My ultimate goal is to create an Excel spreadsheet that has a master list of all possible zip codes in a state in one column, and the number of cases in the datafile that are in each of these zip codes. The problem is that there are zip codes on this list that are not in the datafile (e.g., there is no one who lives in the zip code 12345). I'd like a zero to appear for that zip.

    There is an option in Custom Tables that allows you to choose to include empty cells, BUT this option is limited to numeric variables, and my zipcode variable is a string. I've tried converting it to a numeric variable and then adding value labels that correspond to each zip code on the master list (so 1 = 11111, 2 = 11112, 3 = 11113...) because the option to include empty cells is only available (again) when the variable is numeric and there are value labels. The resulting frequencies output was not correct.

    Does anyone have any suggestions as to how I might be able to achieve the goal (again) of having a spreadsheet with a master list of zip codes, and the number of cases in each zip code in the datafile, with a zero for zip codes that do not appear in the file.

    I hope that makes sense. Thanks in advance for any help you can provide.

    --Kathie






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: How do I produce a frequency table that includes a count of zero for empty cells?

    Posted Fri June 11, 2021 07:25 PM

    The empty cells option is not limited to numeric variables, but you need a value label so that CTABLES knows what the empty categories would be.

    You could create a VALUE LABELS command from a file with a list of all the zip codes that should appear.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: How do I produce a frequency table that includes a count of zero for empty cells?

    Posted Fri June 11, 2021 07:44 PM

    I tried that yesterday, and the frequency table it generated was not correct/did not comport with the data, BUT I just tried it again and it worked EXCEPT that the table lists each zip code twice... one shows 0 cases, and the other shows the actual/correct number of cases. (Weird?)






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: How do I produce a frequency table that includes a count of zero for empty cells?

    Posted Fri June 11, 2021 07:48 PM

    Can you send me the data or a sample of it and the CTABLES syntax (jkpeckSupport Member). I suspect that you have created value labels that don't quite match the data, so you are getting both.






    #SPSSStatistics
    #Support
    #SupportMigration