Replacing empty string cells with specific value

Viewed 1118

as you can see I have a database in SPSS and I encountered a problem where one of the columns has empty cells. Now the problem is that the type of data in that column is string. If it was numeric/integer there are tons of videos showing how to do it but none for string cells. I want to fill the empty string cells with the word "null" or "none" but I can't find a way to do it. Help!

enter image description here

2 Answers

Just run the below syntax:

DO REPEAT S=V13 V16.
IF S="" S="none"
END REPEAT.
EXECUTE.

Store in S all your string variables. only V13 and V16 are visible on screen, so my example is built around them. But you can put as many as you need.

You can use the following syntax:

IF V13 = '' V13 = 'Null'.
EXECUTE.

This syntax translates to something like: "If V13 is blank, make V13 equal to the string value 'Null'.

Related