Missing (sfi.Missing)

class sfi.Missing

This class provides access to Stata missing values.

Method Summary

getValue([val]) Get the numeric value that represents the missing value in Stata.
isMissing(val) Test if a value is a Stata missing.
parseIsMissing(s) Test if a string is a Stata missing.

Method Detail

static getValue(val=None)

Get the numeric value that represents the missing value in Stata.

Parameters:val ({'a', 'b', .., 'z'}, optional) – The character indicating which missing value to get. If val is not specified, the Stata system missing value is returned. If val is specified, it must be one of ‘a’, ‘b’, …, or ‘z’, and the corresponding extended missing value is returned.
Returns:The numeric value of a missing value in Stata.
Return type:float
static isMissing(val)

Test if a value is a Stata missing.

Parameters:val (float) – The value to test.
Returns:True if the value is a Stata missing.
Return type:bool
static parseIsMissing(s)

Test if a string is a Stata missing.

Parameters:s (str) – The string to test.
Returns:True if the string matches a Stata system missing value or an extended missing value.
Return type:bool

Examples

The following provides a few quick examples illustrating how to use this class:

>>> from sfi import Missing, Scalar, Matrix
>>> Scalar.setValue('myscalar', Missing.getValue('z'))
>>> stata: display myscalar
.z
>>> Matrix.create('mymat', 3, 4, Missing.getValue())
>>> stata: matrix list mymat

mymat[3,4]
    c1  c2  c3  c4
r1   .   .   .   .
r2   .   .   .   .
r3   .   .   .   .