Troubleshooting
Problem
I have six string variables (SCH1, SCH2, SCH3, SCH4, SCH5, SCH6). I would like to count the number of responses across all six variables, excluding instances where the response has been left blank. Even under Data->Count, I can only look for specific characters and combinations thereof, how can I count valid values only?
Resolving The Problem
We need to do a bit of reverse thinking. Using the Count Command, you are unnable to count completed values per variable, so you can count missing or blank values.
COUNT
newvar = SCH1 SCH2 SCH3 SCH4 SCH5 SCH6 (' ') .
EXECUTE.
The number of missing cells across the rows is represented in the variable NEWVAR.
Next you will subtract the number of variables being examined (6) from NEWVAR to get the final number of valid non-missing cells from left to right, per case, called CTVAR.
COMPUTE CTVAR = 6 - newvar .
EXECUTE .
Your final syntax should follow this format to get the total row count of non-missing variables.
COUNT
newvar = SCH1 SCH2 SCH3 SCH4 SCH5 SCH6 (' ') .
COMPUTE CTVAR = 6 - newvar .
EXECUTE
Related Information
Historical Number
63274
Was this topic helpful?
Document Information
Modified date:
16 April 2020
UID
swg21477532