📄 serset.hlp
字号:
{smcl}
{* 10feb2005}{...}
{cmd:help serset}
{hline}
{title:Title}
{p2colset 5 19 21 2}{...}
{p2col :{hi:[P] serset} {hline 2}}Creation and manipulation of sersets{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 22 2}
{cmd:serset}
{cmdab:cr:eate}
{varlist}
{ifin}
[{cmd:,}
{cmdab:omitanym:iss}
{cmdab:omitallm:iss}
{cmdab:omitdupm:iss}
{cmdab:omitn:othing}
{opth sort(varlist)}]
{p 8 22 2}
{cmd:serset}
{cmd:create_xmedians}
{it:svn_y}
{it:svn_x}
[{it:svn_w}]
[{cmd:,}
{cmd:bands(}{it:#}{cmd:)}
{cmd:xmin(}{it:#}{cmd:)}
{cmd:xmax(}{it:#}{cmd:)}
{cmd:logx}
{cmd:logy}]
{p 8 22 2}
{cmd:serset}
{cmd:create_cspline}
{it:svn_y}
{it:svn_x}
[{cmd:,}
{cmd:n(}{it:#}{cmd:)}]
{p 8 22 2}
{cmd:serset}
[{cmd:set}]
{it:#_s}
{p 8 22 2}
{cmd:serset}
{cmd:sort}
[{it:svn} [{it:svn} [...]]]
{p 8 22 2}
{cmd:serset}
{cmdab:su:mmarize}
{it:svn}
[{cmd:,}
{cmdab:d:etail}
]
{p 8 22 2}
{cmd:serset}
{cmd:use}
[{cmd:,}
{cmd:clear}
]
{p 8 22 2}
{cmd:serset}
{p 8 22 2}
{cmd:serset}
{cmd:reset_id}
{it:#_s}
{p 8 22 2}
{cmd:serset}
{cmd:drop}
[{numlist} | {cmd:_all}]
{p 8 22 2}
{cmd:serset}
{cmd:clear}
{p 8 22 2}
{cmd:serset}
{cmd:dir}
{pstd}
In addition, the {helpb file} command is extended to allow
{p 8 22 2}
{cmd:file}
{cmd:sersetwrite}
{it:handle}
{p 8 22 2}
{cmd:file}
{cmd:sersetread}
{it:handle}
{pstd}
In addition, the following {help macro:extended macro functions} are available
Extended function Returns from the {it:current serset}
{hline 61}
{cmd:: serset id} ID
{cmd:: serset k} number of variables
{cmd:: serset N} number of observations
{cmd:: serset varnum} {it:svn} {it:svnum} of {it:svn}
{cmd:: serset type} {it:svn} storage type of {it:svn}
{cmd:: serset format} {it:svn} display format of {it:svn}
{cmd:: serset varnames} list of {it:svns}
{cmd:: serset min} {it:svn} minimum of {it:svn}
{cmd:: serset max} {it:svn} maximum of {it:svn}
{hline 61}
Extended macro functions have the syntax
{cmd:local} {it:macname} {cmd::} ...
The {it:current serset} is the most recently created or the most
recently set by the {cmd:serset set} command.
{pstd}
In the above syntax diagrams,
{phang2}
{it:#_s} refers to a serset number, 0 {ul:<} {it:#} {ul:<} 1,999.
{phang2}
{it:varlist} refers to the usual Stata {help varlist}, that is, a list of
variables that appear in the current dataset, not the current serset.
{phang2}
{it:svn} refers to a variable in a serset. The variable may be referred to
either by its name (e.g., {cmd:mpg} or {cmd:l.gnp}) or its number (e.g., 1 or
5); which is used makes no difference.
{phang2}
{it:svnum} refers to a variable number in a serset.
{title:Description}
{pstd}
{cmd:serset} creates and manipulates sersets.
{pstd}
{cmd:file} {cmd:sersetwrite} writes and {cmd:file} {cmd:sersetread} reads
sersets into files.
{pstd}
The extended macro function {cmd::serset} reports information about the
current serset.
{title:Options for serset create}
{phang}
{cmd:omitanymiss}, {cmd:omitallmiss}, {cmd:omitdupmiss}, and {cmd:omitnothing}
specify how observations with missing values are to be treated.
{pmore}
{cmd:omitanymiss} is the default. Observations in which any of the
numeric variables contain missing are omitted from the serset being
created.
{pmore}
{cmd:omitallmiss} specifies that only observations in which all the
numeric variables contain missing are to be omitted.
{pmore}
{cmd:omitdupmiss} specifies that only duplicate observations in which all
the numeric variables contain missing are omitted. Note that the
observations omitted will be a function of the sort order of the original
data.
{pmore}
{cmd:omitnothing} specifies that no observations be omitted
(other than those excluded by the {cmd:if} {it:exp} and {cmd:in}
{it:range}).
{phang}
{cmd:sort(}{it:varlist}{cmd:)} specifies that the serset being created is to
be sorted by the specified variables. The result is no different from,
after serset creation, using the {cmd:serset sort} command, but total
execution time is a little faster. The sort order of the data in memory is
unaffected by this option.
{title:Options for serset create_xmedians}
{phang}
{cmd:bands(}{it:#}{cmd:)} specifies the number of divisions along the x-scale
in which cross medians are to be calculated; the default is
{cmd:bands(200)}. {cmd:bands()} may be specified to be between 3 and 200.
{pmore}
Let {it:m} and {it:M} specify the minimum and maximum value of x.
If the scale is divided into {it:n} bands (i.e., {cmd:bands(}{it:n}{cmd:)}
is specified), the first band is
{it:m} to
{it:m}+({it:M}-{it:m})/{it:n}, the second
{it:m}+({it:M}-{it:m})/{it:n} to
{it:m}+2*({it:M}-{it:m})/{it:n}, ..., and the nth
{it:m}+({it:n}-1)*({it:M}-{it:m})/{it:n} to
{it:m}+{it:n}*({it:M}-{it:m})/{it:n} = {it:m}+{it:M}-{it:m} = {it:M}.
{phang}
{cmd:xmin(}{it:#}{cmd:)} and {cmd:xmax(}{it:#}{cmd:)} specify the minimum and
maximum values of the x variable to be used in the bands
calculation{hline 2}{it:m} and {it:M} in the formulas above. The actual
minimum and maximum are used if these options are not specified. In
addition, if {cmd:xmin()} is specified with a number that is greater than
the actual minimum, the actual minimum is used, and if {cmd:xmax()} is
specified with a number that is less than the actual maximum, the actual
maximum is used.
{phang}
{cmd:logx} and {cmd:logy} specify that cross medians are to be created using a
"log" scale. The exponential of the median of the log of the values is
calculated in each band.
{title:Option for serset create_cspline}
{phang}
{cmd:n(}{it:#}{cmd:)} specifies the number of points to be evaluated between
each pair of x values, which are treated as the knots. The default is
{cmd:n(5)}, and {cmd:n()} may be between 1 and 300.
{title:Option for serset summarize}
{phang}
{cmd:detail} specifies additional statistics, including skewness,
kurtosis, the four smallest and four largest values, and various
percentiles. This option is identical to the {cmd:detail} option of
{helpb summarize}.
{title:Option for serset use}
{phang}
{cmd:clear} permits the serset to be loaded, even if there is a dataset already
in memory and even if that dataset has changed since it was last saved.
{title:Remarks}
{pstd}
Sersets are used in implementing Stata's graphics capabilities. When you make
a graph, the data for the graph are extracted into a serset and then, at the
lowest levels of Stata's graphics implementation, are graphed from there.
{pstd}
Sersets are like datasets: they contain observations on one or more
variables. Each serset is assigned a number, and, in your program, you use
that number when referring to a serset. Thus multiple sersets can reside
simultaneously in memory. (Sersets are, in fact, stored in a combination of
memory and temporary disk files, so accessing their contents is slower than
accessing the data in memory. Sersets, however, are fast enough to keep up
with graphics operations.)
{title:serset create}
{pstd}
{cmd:serset create} creates a new serset from the data in memory. For
instance,
{cmd:. serset create mpg weight}
{pstd}
creates a new serset containing variables {cmd:mpg} and {cmd:weight}. When
using the serset subsequently, you can refer to these variables by their
names, {cmd:mpg} and {cmd:weight}, or by their numbers, {cmd:1} and {cmd:2}.
{pstd}
{cmd:serset create} also returns in {cmd:r()}:
{cmd:r(N)} the number of observations placed into the serset
{cmd:r(k)} the number of variables placed into the serset
{cmd:r(id)} the number assigned to the serset
{pstd}
{cmd:r(N)} and {cmd:r(k)} are just for your information; by far the most
important returned result is {cmd:r(id)}. You will need to use this number
in subsequent commands to refer to this serset.
{pstd}
In addition, {cmd:serset create} sets the current serset to the one just
created. Commands that use sersets always use the current serset. If, in
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -