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

📄 mf_st_dropvar.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 23mar2005}{...}
{cmd:help mata st_dropvar()}
{hline}
{* index st_dropvar()}{...}
{* index st_dropobsin()}{...}
{* index st_dropobsif()}{...}
{* index st_keepvar()}{...}
{* index st_keepobsin()}{...}
{* index st_keepobsif()}{...}

{title:Title}

{p 4 4 2}
{bf:[M-5] st_dropvar() -- Drop variables or observations}


{title:Syntax}

{p 8 12 2}
{it:void}
{cmd:st_dropvar(}{it:transmorphic rowvector vars}{cmd:)}


{p 8 12 2}
{it:void}
{cmd:st_dropobsin(}{it:real matrix range}{cmd:)}

{p 8 12 2}
{it:void}
{cmd:st_dropobsif(}{it:real colvector select}{cmd:)}


{p 8 12 2}
{it:void}
{cmd:st_keepvar(}{it:transmorphic rowvector vars}{cmd:)}


{p 8 12 2}
{it:void}
{cmd:st_keepobsin(}{it:real matrix range}{cmd:)}

{p 8 12 2}
{it:void}
{cmd:st_keepobsif(}{it:real colvector select}{cmd:)}


{title:Description}

{p 4 4 2}
{cmd:st_dropvar(}{it:vars}{cmd:)} drops the variables specified.
{it:vars} is a row vector which may contain either variable names or 
variable indices.  {cmd:st_dropvar(.)} drops all variables and observations.

{p 4 4 2}
{cmd:st_dropobsin()} and 
{cmd:st_dropobsif()} have to do with dropping observations.

{p 4 4 2}
{cmd:st_dropobsin(}{it:range}{cmd:)} specifies the observations to be dropped:

{p 8 12 2}
{cmd:st_dropobsin(5)} drops observation 5.  

{p 8 12 2}
{cmd:st_dropobsin((5,9))} drops observations 5 through 9.  

{p 8 12 2}
{cmd:st_dropobsin((5\8\12))} drops observations 5 and 8 and 12.

{p 8 12 2}
{cmd:st_dropobsin((5,7\8,11\13,13))} drops observations 5 through 7, 8
through 11, and 13.

{p 8 12 2}
{cmd:st_dropobsin(.)} drops all observations (but not the variables).

{p 8 12 2}
{cmd:st_dropobsin(J(0,1,.))} drops no observations (or variables).

{p 4 4 2}
{cmd:st_dropobsif(}{it:select}{cmd:)} specifies a {cmd:st_nobs()} {it:x} 1
vector.  Observations {it:i} for which {it:select}[{it:i}]!=0 are dropped.

{p 4 4 2}
{cmd:st_keepvar()}, 
{cmd:st_keepobsin()}, and {cmd:st_keepobsif()} do the same thing, 
except that the variables and observations to be kept are specified.


{title:Remarks}

{p 4 4 2}
To drop all variables and observations, code 
{cmd:st_dropvar(.)},  
{cmd:st_keepvar(J(1,0,.))}, 
or
{cmd:st_keepvar(J(1,0,""))}.  All do the same thing.
Dropping all the variables clears the dataset.

{p 4 4 2}
Dropping all the observations, however, leaves the variables in place.


{title:Conformability}

    {cmd:st_dropvar(}{it:vars}{cmd:)}, {cmd:st_keepvar(}{it:vars}{cmd:)}:
	     {it:vars}:  1 {it:x k}
	   {it:result}:  {it:void}


    {cmd:st_dropobsin(}{it:range}{cmd:)}, {cmd:st_keepobsin(}{it:range}{cmd:)}:
	    {it:range}:  {it:k x} 1  or  {it:k x} 2
	   {it:result}:  {it:void}

    {cmd:st_dropobsif(}{it:select}{cmd:)}, {cmd:st_keepobsif(}{it:select}{cmd:)}:
	   {it:select}:  {cmd:st_nobs()} {it:x} 1
	   {it:result}:  {it:void}


{title:Diagnostics}

{p 4 4 2}
{cmd:st_dropvar(}{it:vars}{cmd:)} and
{cmd:st_keepvar(}{it:vars}{cmd:)}
abort with error if any element of {it:vars} is missing unless {it:vars} is 1
{it:x} 1, in which case they drop or keep all the variables.

{p 4 4 2}
{cmd:st_dropvar(}{it:vars}{cmd:)} and
{cmd:st_keepvar(}{it:vars}{cmd:)}
abort with error if any element of {it:vars} is not a valid variable index or
name, or if {it:vars} is a view.
Note that if {it:vars} is specified as names, abbreviations are not allowed.

{p 4 4 2}
{cmd:st_dropvar()} and {cmd:st_keepvar()} set
{bf:{help mf_st_updata:[M-5] st_updata()}} unless all variables dropped
are temporary; see {bf:{help mf_st_tempname:[M-5] tempname()}}.

{p 4 4 2}
{cmd:st_dropobsin(}{it:range}{cmd:)} and
{cmd:st_keepobsin(}{it:range}{cmd:)}
abort with error if any element of {it:range} is missing unless {it:range} is
1 {it:x} 1, in which case they drop or keep all the observations.

{p 4 4 2}
{cmd:st_dropobsin(}{it:range}{cmd:)} and
{cmd:st_keepobsin(}{it:range}{cmd:)}
abort with error if any element of {it:range} is not a valid observation
number (is not between 1 and {bf:{help mf_st_nvar:[M-5] st_obs()}} inclusive),
or if {it:range} is a view.

{p 4 4 2}
{cmd:st_dropobsif(}{it:select}{cmd:)} and
{cmd:st_keepobsif(}{it:select}{cmd:)}
abort with error if {it:select} is a view.

{p 4 4 2}
{cmd:st_dropobsin()}, 
{cmd:st_dropobsif()}, 
{cmd:st_keepobsin()}, and
{cmd:st_keepobsif()}
set {bf:{help mf_st_updata:[M-5] st_updata()}} if any observations 
are removed from the data.

{p 4 4 2}
Be aware that, after dropping any variables or observations, any 
previously constructed views (see {bf:{help mf_st_view:[M-5] st_view()}})
are probably invalid because views are internally stored in terms of 
variable and observations numbers.   Subsequent use of an invalid view  
may lead to unexpected results or an abort with error.


{title:Source code}

{p 4 4 2}
Functions are built-in.


{title:Also see}

{p 4 13 2}
Manual:  {hi:[M-5] st_dropvar()}

{p 4 13 2}
Online:  help for 
{bf:{help m4_stata:[M-4] stata}}
{p_end}

⌨️ 快捷键说明

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