SPSS FAQ How can I count how many cases are missing in a string variable?
There are at least two ways to find out how many missing cases there are in a string variable. The first way is to use the missing values command to define a missing value for the variable. The second way is to create a new variable which is zero if the value is not missing and one if it is missing. To do that, you will need to use the length and the trim functions with the compute command. Consider the data set below. We have two string variables, fname (first name) and lname (last name). Because we have given fname a length of five and lname a length of eight, both variables are short string variables. (Note that if we had just typed (A), the length of the string variable would have been one, not the length of the first case, as it would have been in other statistical packages, such as SAS.