⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 missing.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 05apr2005}{...}
{cmd:help missing}
{hline}

{title:Title}

{pstd}
{hi:[U] 12.2.1 Missing values}


{title:Description}

{pstd}
Stata has 27 numeric missing values:

{pmore}
{cmd:.}, the default, which is called the "system missing value"
or {cmd:sysmiss}

    and

{pmore}
{cmd:.a}, {cmd:.b}, {cmd:.c}, ..., {cmd:.z}, which are called the
"extended missing values".

{pstd}
Numeric missing values are represented by large positive values.
The ordering is

{center:{it:all nonmissing numbers} < {cmd:.} < {cmd:.a} < {cmd:.b} < ... < {cmd:.z}}

{pstd}
Thus, the expression "{cmd:age > 60}" is true if variable {cmd:age} is
greater than 60 or missing.

{pstd}
To exclude missing values ask whether the value is less than "{cmd:.}".  For
instance,

{phang2}{cmd:. list if age > 60 & age < .}

{pstd}
To specify missing values ask whether the value is greater than or equal to
"{cmd:.}".  For instance,

{phang2}{cmd:. list if age >=.}

{pstd}
Stata has one string missing value, which is denoted by {cmd:""} (blank).


{title:Remarks}

{pstd}
Additional details concerning missing values and their treatment in Stata is
provided under the headings

	{help missing##overview:Overview}
	{help missing##expressions:Expressions}
	{help missing##operators:Operators}
	{help missing##functions:Functions}
	{help missing##matrices:Matrices}
	{help missing##useful:Useful commands}
	{help missing##value:Value labels}
	{help missing##estimation:Estimation commands}
	{help missing##technical:Technical note:  Version 7 and earlier}


{marker overview}{...}
    {title:Overview}

{phang}
1.  Stata supports different types of numeric missing values that can be used
    to specify different reasons that a value is unknown.  The most frequently
    used missing value {cmd:.}, referred to as sysmiss, is nearly always
    generated by Stata when it is not able to assign a specific value.  The 26
    extended missing values {cmd:.a}, {cmd:.b}, ..., {cmd:.z} are available to
    users requiring more elaborate tracking of missing values.

{pmore}Empty strings are treated as missing values of type string.

{phang}
2.  Numeric missing values are represented by large positive values.  This
    means that an expression such as {bind:{cmd:income > 100}} evaluates to
    {hi:true} for missing values of the variable {cmd:income}, as well as to
    those that are greater than 100.  Also, the simple expression
    {cmd:if {it:varname}} evaluates to true for all nonzero values of
    {it:varname}, including missing values.

{phang}
3.  The ordering of missing values is

{center:{it:all nonmissing numbers} < {cmd:.} < {cmd:.a} < {cmd:.b} < ... < {cmd:.z}}

{phang}
4.  Most Stata statistical commands deal with missing values by disregarding
    observations with one or more missing values (called "listwise deletion"
    or "complete cases only").


{marker expressions}{...}
    {title:Expressions}

{pstd}
Expressions occur in many places in Stata (see {helpb syntax} and help
{help exp}).  For example,

{phang2}
{cmd:. generate} {it:newvarname} {cmd:=} {it:exp}

{pstd}
evaluates the expression {it:exp} for each observation of the variable
{it:newvarname}.  Observations of {it:newvarname} are set to missing if
{it:exp} evaluates to missing.

{pstd}
Expressions are also used to restrict a command's operation to a subset of the
observations.  For instance,

{phang2}
{cmd:. summarize} {cmd:varname} {cmd:if} {it:exp}

{pstd}
summarizes {it:varname} using all observations for which {it:exp} evaluates to
true (not zero), including observations that are missing.


{marker operators}{...}
    {title:Operators}

{pstd}
The relational operators (see {help operators}) interpret missing values
as large positive numbers (see above). Thus all of the following evaluate to
true

		{cmd:73 < .}        {cmd:. == .}        {cmd:.a == .a}
        	{cmd:.a != .}       {cmd:.a < .b}       {cmd:.a <= .b}

{pstd}
while all of the following evaluate to false

		{cmd:73 >= .}       {cmd:. == .a}       {cmd:. > .a}

{pstd}
The numerical operators ({cmd:+} etc) return missing if any of their arguments
are missing.


{marker functions}{...}
    {title:Functions}

{pstd}
Stata has a few special functions for dealing with missing values:

{p 8 25 2}{cmd:missing()}{space 7}
  returns 1 (meaning true) if any of its arguments, numeric or string, evaluate
to missing and 0 (meaning false) otherwise.

{p 8 25 2}{cmd:mi()}{space 12}
  is a shorthand for {cmd:missing()}.

{p 8 25 2}{cmd:matmissing(}{it:m}{cmd:)}{space 3}
  returns 1 (meaning true) if any elements of the matrix {it:m} are missing
  and 0 (meaning false) otherwise.

{pstd}
Some Stata functions interpret {cmd:.} in a special way.  For instance,
the function {cmd:inrange(x,a,b)} returns 1 if {cmd:x} belongs in
the interval {cmd:[a,b]}.  This function interprets {cmd:a==.} as
-infinity, and {cmd:b==.} as +infinity.  These special interpretations
are discussed in {help functions}.

{pstd}
Other Stata functions return missing ({cmd:.}) if one or more of the arguments
are missing or invalid.


{marker matrices}{...}
    {title:Matrices}

{pstd}
Matrices may contain all types of missing values.  The matrix operators
(see {help matrix operators})

                {cmd:-}     negate
		{cmd:'}     transpose

                {cmd:-}     subtract
                {cmd:+}     add
                {cmd:\}     row join
                {cmd:,}     column join
		{cmd:#}     Kronecker product

{pstd}
generate missing values element-wise.

{pstd}
In the matrix product {cmd:C=A*B}, {cmd:C}[{it:i},{it:j}] is missing if row
{it:i} of {cmd:A} or column {it:j} of {cmd:B} contain a missing value.

{pstd}
Matrix division by scalar {cmd:C=A/b} is not allowed if the scalar {cmd:b}
is a missing value.  Otherwise, missing values in matrix {cmd:A} generate
missing values in {cmd:C} element-wise.

{pstd}
Like the {helpb list} command, the {helpb matrix list} command has a
{cmd:nodotz} option to display extended missing value {cmd:.z} as a blank
string rather than as "{cmd:.z}".


{marker useful}{...}
    {title:Useful commands}

{p2colset 5 25 27 2}{...}
{p2line}
{p2col:{helpb mvencode}}transforms missing values into numeric values{p_end}
{p2col:{helpb mvdecode}}transforms numeric values into missing values{p_end}
{p2col:{helpb codebook}}provides extensive information about variables,
	including the occurrence of simple and extended missing values{p_end}
{p2col:{helpb egen:egen, rownonmiss()}}number of valid observations in a
	varlist{p_end}
{p2col:{helpb egen:egen, rowmiss()}}number of missing values in a varlist{p_end}
{p2col:{helpb recode}}recodes a variable, optionally into a new variable, with
	special facilities to recode missing values.{p_end}
{p2col:{helpb impute}}regression imputation of missing values{p_end}
{p2col:{helpb xtdes}}describes participation patterns in panel data{p_end}
{p2line}
{p2colreset}{...}


{marker value}{...}
    {title:Value labels}

{pstd}
It is possible to define value labels for the extended missing values
{cmd:.a} to {cmd:.z}, but not for sysmiss {cmd:.}.  These value labels
show up in the same way as value labels for nonmissing values.  See
{helpb label}.


{marker estimation}{...}
    {title:Estimation commands}

{pstd}
Most Stata commands ignore observations that are missing in one or more
of the variables referred to in the command.  For instance, the regression
command {helpb regress} disregards all observations that have a missing value
for the dependent variable or missing values for any of the independent
variables.  This method is known as "listwise deletion", "complete cases
only", etc.  It is statistically appropriate only if the missing values
are "at random".  In an {help if} or {help weight} expression to a command,
the expressions will be evaluated, and the missing values will be
processed using the operators and function() logic.

{pstd}
Stata commands that can treat multiple observations as being related to
a single observational unit (e.g., observations from a panel in {help xt}
models, episodes in {help st} models, etc) ignore specific observations
from the "group", namely those that have missing values.


{marker technical}{...}
    {title:Technical note:  Version 7 and earlier}

{pstd}
Before Stata 8, Stata only had a single missing value, the period {cmd:.}.
Thus, you could test whether an expression or variable {it:exp} was missing
with the expression {cmd:{it:exp}==.}.  Starting with Stata 8, this method is
no longer correct.  {cmd:{it:exp}==.} now means that the expression {it:exp}
equals a specific missing value, namely sysmiss {cmd:.}.  {cmd:{it:exp}==.}
returns false if {it:exp} equals one of the extended missing value types such
as {cmd:.a} or {cmd:.z}.  To test whether {it:exp} is missing, i.e., equals
either {cmd:.} or one of the extended missing values, one should use the
expressions

	{it:exp} {cmd:>= .}
    or
	{cmd:missing(}{it:exp}{cmd:)}

    which can be abbreviated to

	{cmd:mi(}{it:exp}{cmd:)}

{pstd}
To test that {it:exp} is not missing, use one of the forms

	{it:exp} {cmd:< .}
	{cmd:!missing(}{it:exp}{cmd:)}
	{cmd:!mi({it:exp})}

{pstd}
An advantage of the latter two forms is that the missing functions
{cmd:missing()} and {cmd:mi()} allow multiple (numeric or string) arguments
to test whether any of the arguments is missing.

{pstd}
Old programs and do-files will continue to work using the old method, as
long as the version is set to 7 or less.  See {helpb version}.

{pstd}
Another consequence of the introduction of extended missing values is that the
range of numbers that can be stored in integer typed variables has decreased.
In Stata up to version 7, {cmd:byte} variables could have values in the range
-127..126.  In version 8 {cmd:byte}s have the smaller range -127..100.
Numbers in the range 101..126 now represent the extended missing values.  If
Stata 8 reads a data set stored in Stata 7 or earlier with byte variables with
values in the range 101..126, Stata will silently promote the datatype to
{cmd:int}, thus ensuring no loss of information.  Similar promotions may occur
from {cmd:int} and {cmd:long} variables.  Thus, occasionally, Stata data sets
have become somewhat larger.


{title:Also see}

{psee}
Manual:  {bf:[U] 12.2.1 Missing values},{break}
{bf:[D] missing values}

{psee}
Online:  {helpb codebook},
{helpb egen},
{help exp},
{help functions},
{helpb impute},
{helpb mvencode},
{help operators},
{helpb recode},
{helpb xtdes}
{p_end}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -