COMPUTE Q1_d=LENGTH(Q1)>0.
Which will create a 0/1 dichotomous variable Q1_d. If there are data / characters in the string data of the string in Q1, then 1 (one) will be assigned in Q1_d else, if Q1 is an empty string, then 0 (zero) will be assigned.
source
to share