📄 separate.hlp
字号:
{smcl}
{* 20jan2005}{...}
{cmd:help separate}{right:dialog: {bf:{dialog separate}}}
{hline}
{title:Title}
{p2colset 5 21 22 2}{...}
{p2col :{hi:[D] separate} {hline 2}}Create separate variables{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 25 2}
{cmd:separate}
{varname}
{ifin}
{cmd:,} {cmd:by(}{it:byvar}{c |}{it:exp}{cmd:)}
[{it:options}]
{synoptset 22 tabbed}{...}
{synopthdr}
{synoptline}
{syntab :Main}
{p2coldent :* {opt by(byvar)}}
categorize observations into groups defined by {it:byvar}{p_end}
{p2coldent :* {opth by(exp)}}
categorize observations into two groups defined by {it:exp}{p_end}
{syntab :Options}
{synopt :{opt g:enerate(stubname)}}name new variables by suffixing values to
{it:stubname}; default is to use {varname} as prefix{p_end}
{synopt :{opt seq:uential}}use as name suffix categories numbered sequentially
from 1{p_end}
{synopt :{opt miss:ing}}create variables for the missing values{p_end}
{synopt :{opt short:label}}create shorter variable labels{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}* Either {opt by(byvar)} or {opt by(exp)} must be specified.{p_end}
{title:Description}
{pstd}
{opt separate} creates new variables containing values from {varname}.
{title:Options}
{dlgtab:Main}
{phang}
{cmd:by(}{it:byvar}|{it:exp}{cmd:)}
specifies a single variable defining the categories or a logical expression
that categorizes the observations into two groups.
{pmore}
If {opt by(byvar)} is specified, {it:byvar} may be a numeric
or string variable taking on any values.
{pmore}
If {opth by(exp)} is specified, the expression must evaluate
to true (1), false (0), or missing.
{pmore}
{opt by()} is required.
{dlgtab:Options}
{phang}
{opt generate(stubname)} specifies how the new variables are to be named. If
{opt generate()} is not specified, {opt separate} uses the name of the
original variable, shortening it if necessary. If {opt generate()} is
specified, {opt separate} uses {it:stubname}. If any of the resulting
names is too long when the values are suffixed, it is not shortened and an
error message is issued.
{phang}
{opt sequential} specifies that categories be numbered sequentially from 1.
By default, {opt separate} uses the actual values recorded in the original
variable, if possible, and sequential numbers, otherwise. {opt separate}
can use the original values if they are all non-negative integers smaller
than 10,000.
{phang}
{opt missing} additionally creates a variable for the category missing
if missing occurs ({it:byvar} takes on the value missing or {it:exp}
evaluates to missing). The resulting variable is named in the usual
manner but with an appended underscore; e.g., {cmd:bp_}. By default,
{opt separate} creates no such variable. Note that the contents of other
variables are unaffected by whether {opt missing} is specified.
{phang}
{opt shortlabel} causes the creation of a variable label that is shorter than
the default.
{title:Examples}
{phang}{cmd:. separate mpg, by(foreign)}{p_end}
{phang}{cmd:. qqplot mpg0 mpg1}{p_end}
{phang}{cmd:. separate mpg, by(price>6000) gen(mpgpr)}{p_end}
{phang}{cmd:. qqplot mpgpr0 mpgpr1}{p_end}
{title:Also see}
{psee}
Manual: {bf:[D] separate}
{psee}
Online: {helpb tabulate}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -