📄 mf_st_addobs.hlp
字号:
{smcl}
{* 21oct2004}{...}
{cmd:help mata st_addobs()}
{hline}
{* index st_addobs()}{...}
{* index _st_addobs()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] st_addobs() -- Add observations to current Stata dataset}
{title:Syntax}
{p 8 12 2}
{it:void}{bind: }
{cmd:st_addobs(}{it:real scalar n}{cmd:)}
{p 8 12 2}
{it:void}{bind: }
{cmd:st_addobs(}{it:real scalar n}{cmd:,}
{it:real scalar nofill}{cmd:)}
{p 8 12 2}
{it:real scalar}
{cmd:_st_addobs(}{it:real scalar n}{cmd:)}
{p 8 12 2}
{it:real scalar}
{cmd:_st_addobs(}{it:real scalar n}{cmd:,}
{it:real scalar nofill}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:st_addobs(}{it:n}{cmd:)} adds {it:n} observations to the current Stata
dataset.
{p 4 4 2}
{cmd:st_addobs(}{it:n}{cmd:,} {it:nofill}{cmd:)} does the same thing, but
saves computer time by not filling in the additional observations with the
appropriate missing-value code if {it:nofill}!=0.
{cmd:st_addobs(}{it:n}{cmd:, 0)} is equivalent to {cmd:st_addobs(}{it:n}}.
Use of {cmd:st_addobs()} with {it:nofill}!=0 is not recommended. If you
specify {it:nofill}!=0, it is your responsibility to ensure that the
added observations ultimately are filled in or removed before control is
returned to Stata.
{p 4 4 2}
{cmd:_st_addobs(}{it:n}{cmd:)}
and
{cmd:_st_addobs(}{it:n}{cmd:,} {it:nofill}{cmd:)} perform the same action
as
{cmd:st_addobs(}{it:n}{cmd:)}
and
{cmd:st_addobs(}{it:n}{cmd:,} {it:nofill}{cmd:)}, except that they
return 0 if successful and the appropriate Stata return code otherwise
(otherwise usually being caused by insufficient memory).
Where {cmd:_st_addobs()} would return nonzero,
{cmd:st_addobs()} aborts with error.
{title:Remarks}
{p 4 4 2}
There need not be any variables defined to add observations. If you are
attempting to create a dataset from nothing, you can add the observations
first and then add the variables, or add the variables and then add the
observations. Use {bf:{help mf_st_addvar:[M-5] st_addvar()}} to add
variables.
{title:Conformability}
{cmd:st_addobs(}{it:n}{cmd:,} {it:nofill}{cmd:)}:
{it:n}: 1 {it:x} 1
{it:nofill}: 1 {it:x} 1
{it:result}: {it:void}
{cmd:_st_addobs(}{it:n}{cmd:,} {it:nofill}{cmd:)}:
{it:n}: 1 {it:x} 1
{it:nofill}: 1 {it:x} 1
{it:result}: 1 {it:x} 1
{title:Diagnostics}
{p 4 4 2}
{cmd:st_addobs(}{it:n}[{cmd:,} {it:nofill}]{cmd:)} and
{cmd:_st_addobs(}{it:n}[{cmd:,} {it:nofill}]{cmd:)}
abort with error if {it:n}<0. They do nothing if {it:n}==0.
{p 4 4 2}
{cmd:st_addobs()} aborts with error if there is insufficient memory
to add the requested number of observations.
{p 4 4 2}
{cmd:_st_addobs()} aborts with error if {it:n}<0, but otherwise returns
the appropriate Stata return code if the observations cannot be added.
If they are added, 0 is returned.
{p 4 4 2}
{cmd:st_addobs()} and {cmd:_st_addobs()} do not set
{bf:{help mf_st_updata:[M-5] st_updata()}}; it is your responsibility to
set it if you want it set.
{title:Source code}
{p 4 4 2}
Functions are built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] st_addobs()}
{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 + -