Showing posts with label sysmis. Show all posts
Showing posts with label sysmis. Show all posts

Thursday, 3 November 2011

Uses of (System) missing

Sometimes you want to assign your newly computed variable a system missing value (which is a . in spss database). Here is the command for that:

COMPUTE temp = $sysmis.

(this syntax will create a variable called temp which will initially have all values set as missing)

For a conditional function:

IF sysmis(v1) v2=$sysmis.

You can also use missing values in RECODE.

RECODE (sysmis=99)

or

RECODE (99=sysmis)

RECODE [your command] (ELSE=sysmis).
Also read the UCLA SPSS page  and CDC page on handling of missing data.

Saturday, 27 November 2010

RECODE in STATA

recode var names (1 2 = 1 low)  ///
(3 = 2 medium) ///
(4 5 = 3 high) ///
(nonmissing = 9 "something else") ///
(missing = .) ///
, gen(Rx Ry) label(Cat3)

Use mvencode and mvdecode to deal with missing values.
For example to convert 99 into sysmis
in the variable mstatus,

mvdecode mstatus, mv(99)

For the opposite effect,
mvencode mstatus, mv(99)