开发者

Can't assign missing value to string

I am using the SPSS syntax editor to combine string variables. I know that there w开发者_如何学Goill be data in one or zero of the variables for each record, but there will never be data in both variables. This is my code, and the problem is with the first line:

IF (MISSING(ywFamilyPlayers)=1) AND (MISSING(vywFamilyPlayersBoolean)=1) THEN newString=missing.
IF (MISSING(ywFamilyPlayers)=0) newString=VALUELABEL(ywFamilyPlayers).
IF (MISSING(vywFamilyPlayersBoolean)=0) newString=VALUELABEL(vywFamilyPlayersBoolean).
EXECUTE.

I cannot figure out how to assign the system missing value to the string variable when it matches the logical conditions. I can easily assign nonsense text (e.g. "-999" or "") under those conditions, but the system won't treat it as a true missing value when running tests on the data.

Can you help me out? The logic works, but I just cannot figure out how to assign the missing value. I've experimented with many permutations (e.g. $sysmis and MISSING) but to no avail.


Note that there are two types of missingnes in SPSS. Value can be system-missing or user-missing. As far as I know system-missing values are defined only for numeric variables. User-missing values can be defined both for numeric and string variables.

Try MISSING VALUES command to define value "-999" (for example) as user-missing.

IF (MISSING(ywFamilyPlayers)=1) AND (MISSING(vywFamilyPlayersBoolean)=1) newString="-999".
MISSING VALUES newString ("-999").
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜