Missing (sfi.Missing)¶
-
class
sfi.
Missing
¶ This class provides access to Stata missing values.
Method Summary
getMissing
(value)Get the missing symbol associated with `value’ that represents the corresponding missing value in Stata. 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
getMissing
(value)¶ Get the missing symbol associated with `value’ that represents the corresponding missing value in Stata.
Parameters: value (float) – The value to test. Returns: Get the missing value symbol. ‘.’, ‘.a’, ‘.b’, …, ‘.z’ or None if `value’ is not a Stata missing value. Return type: str
-
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
-
static
Examples¶
The following provides a few quick examples illustrating how to use this class:
>>> from sfi import Missing, Scalar, Matrix
>>> Missing.getMissing(Missing.getValue())
'.'
>>> Missing.getMissing(Missing.getValue('.a'))
'.a'
>>> 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 . . . .