📄 egen.hlp
字号:
{smcl}
{* 07dec2004}{...}
{cmd:help egen}{right:dialog: {bf:{dialog egen}}}
{hline}
{title:Title}
{p2colset 5 17 19 2}{...}
{p2col :{hi:[D] egen} {hline 2}}Extensions to generate{p_end}
{p2colreset}{...}
{title:Syntax}
{p 8 14 2}
{cmd:egen} [{it:{help type}}] {newvar} {cmd:=} {it:fcn}({it:arguments}) {ifin}
[{cmd:,} {it:options}]
{phang}
{cmd:by} may be used with some of the {cmd:egen} functions as noted below.
{phang}
where depending on the {it:fcn}, {it:arguments} refers to an expression,
{varlist}, or {it:{help numlist}}, and the {it:options} are also {it:fcn}
dependent, and where {it:fcn} is
{phang2}{opth anycount(varlist)}{cmd:,}
{opt v:alues}{cmd:(}{it:integer} {it:{help numlist}}{cmd:)}{p_end}
{pmore2}may not be combined with {cmd:by}. It returns the number of variables
in {it:varlist} for which values are equal to any of the integer values in a
supplied numlist. Values for any observations excluded by either
[{it:{help if}}] or [{it:{help in}}] are set to 0 (not missing). Also see
{opt anyvalue(varname)} and {opt anymatch(varlist)}.
{phang2}
{opth anymatch(varlist)}{cmd:,}
{opt v:alues}{cmd:(}{it:integer} {it:{help numlist}}{cmd:)}{p_end}
{pmore2}
may not be combined with {cmd:by}. It is 1 if any of the variables in
{it:varlist} are equal to any of the integer values in a supplied
{it:numlist} and 0 otherwise. Values for any observations excluded by either
[{it:{help if}}] or [{it:{help in}}] are set to 0 (not missing). Also see
{opt anyvalue(varname)} and {opt anycount(varlist)}.
{phang2}
{opth anyvalue(varname)}{cmd:,}
{opt v:alues}{cmd:(}{it:integer} {it:{help numlist}}{cmd:)}{p_end}
{pmore2}
may not be combined with {cmd:by}. It takes the value of {it:varname} if
{it:varname} is equal to any of the integer values in a supplied {it:numlist}
and is missing otherwise. Also see {opt anymatch(varlist)} and
{opt anycount(varlist)}.
{phang2}
{opth concat(varlist)} [{cmd:,} {opth f:ormat(%fmt)} {opt d:ecode}
{opt maxl:ength(#)} {opt p:unct}{cmd:(}{it:pchars}{cmd:)}]{p_end}
{pmore2}
may not be
combined with {cmd:by}. It concatenates {it:varlist} to produce a string
variable. Values of string variables are unchanged. Values of numeric
variables are converted to string, as is, or converted using a format under
option {cmd:format(%}{it:fmt}{cmd:)} or decoded under option {opt decode}, in
which case {opt maxlength()} may also be used to control the maximum label
length used. By default, variables are added end to end:
{opt punct(pchars)} may be used to specify punctuation, such
as a space, {cmd:punct(" ")}, or a comma, {cmd:punct(,)}.
{opth count(exp)} {right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
creates a constant (within {it:varlist}) containing the number of nonmissing
observations of {it:exp}. Also see {opt rownonmiss()} and {opt rowmiss()}
below.
{phang2}
{opth cut(varname)}{cmd:,}
{c -(}{cmd:at(}{it:#}{cmd:,}{it:#}{cmd:,}{it:...}{cmd:,}{it:#}{cmd:)}|{opt g:roup}{cmd:(}{it:#}{cmd:)}{c )-} [{opt ic:odes} {opt lab:el}]{p_end}
{pmore2}
may not be combined with {cmd:by}. It creates a new categorical variable
coded with the left-hand ends of the grouping intervals specified in the
{opt at()} option, which expects an ascending numlist.
{pmore2}
{cmd:at(}{it:#}{cmd:,}{it:#}{cmd:,}{it:...}{cmd:,}{it:#}{cmd:)}
supplies the breaks for the groups, in ascending order. The list of break
points may be simply a list of numbers separated by commas but can also
include the syntax {cmd:a(b)c}, meaning from {cmd:a} to {cmd:c} in steps of
size {cmd:b}. If no breaks are specified, the command expects the option
{opt group()}.
{pmore2}
{opt group(#)} specifies the number of equal frequency grouping intervals to
be used in the absence of breaks. Specifying this option automatically
invokes {opt icodes}.
{pmore2}
{opt icodes} requests that the codes 0, 1, 2, etc., be used in place of
the left-hand ends of the intervals.
{pmore2}
{cmd:label} requests that the integer-coded values of the grouped
variable be labeled with the left-hand ends of the grouping intervals.
Specifying this option automatically invokes {opt icodes}.
{phang2}
{opth diff(varlist)}{p_end}
{pmore2}
may not be combined with {cmd:by}. It creates an indicator variable equal to
1 if the variables in {it:varlist} are not equal and 0 otherwise.
{phang2}
{opt ends}{cmd:(}{it:strvar}{cmd:)} [{cmd:,} {cmdab:p:unct:(}{it:pchars}{cmd:)}
{cmdab:tr:im} [{cmdab:h:ead}|{cmdab:t:ail}|{cmdab:l:ast}]]{p_end}
{pmore2}
may not be combined with {cmd:by}. It gives the first "word" or head (with
the {opt head} option), the last "word" (with the {opt last} option), or the
remainder or tail (with the {opt tail} option) from string variable
{it:strvar}.
{pmore2}
{opt head}, {opt last}, and {opt tail} are determined by the occurrence
of {it:pchars}, which is by default a single space (" ").
{pmore2}
The head is whatever precedes the first occurrence of {it:pchars}, or
the whole of the string if it does not occur. For example, the head of
"frog toad" is "frog", and that of "frog" is "frog". With {cmd:punct(,)}, the
head of "frog,toad" is "frog".
{pmore2}
The last word is whatever follows the last occurrence of {it:pchars} or
is the whole of the string if a space does not occur. The last word of "frog
toad newt" is "newt", and that of "frog" is "frog". With {cmd:punct(,)}, the
last word of "frog,toad" is "toad".
{pmore2}
The remainder or tail is whatever follows the first occurrence of {it:pchars},
which will be the empty string "" if {it:pchars} does not occur. The
tail of "frog toad newt" is "toad newt", and that of "frog" is "". With
{cmd:punct(,)}, the tail of "frog,toad" is "toad".
{pmore2}
The {opt trim} option trims any leading or trailing spaces.
{phang2}
{opth fill(numlist)}{p_end}
{pmore2}
may not be combined with {cmd:by}. It creates a variable of ascending or
descending numbers or complex repeating patterns. {it:numlist} must contain
at least two numbers and may be specified using standard {it:numlist}
notation; see {help numlist}. [{it:{help if}}] and [{it:{help in}}] are not
allowed with {opt fill()}.
{phang2}
{opth group(varlist)} [{cmd:,} {opt m:issing}
{opt l:abel} {opt lname}{cmd:(}{it:name}{cmd:)}
{opt t:runcate}{cmd:(}{it:num}{cmd:)}]{p_end}
{pmore2}
may not be combined with {cmd:by}. It creates a single variable taking on
values 1, 2, ... for the groups formed by {it:varlist}. {it:varlist} may
contain numeric variables, string variables, or a combination of the two. The
order of the groups is that of the sort order of {it:varlist}. {opt missing}
indicates that missing values in {it:varlist}
{bind:(either {cmd:.} or {cmd:""}}) are to be treated like any other value
when assigning groups, instead of as missing values being assigned to the
group missing. The {opt label} option returns integers from 1 up according to
the distinct groups of {it:varlist} in sorted order. The integers are labeled
with the values of {it:varlist} or the value labels, if they exist.
{opt lname()} specifies the name to be given to the value label created to
hold the labels; {opt lname()} implies {opt label}. The {opt truncate()}
option truncates the values contributed to the label from each variable in
{it:varlist} to the length specified by the integer argument {it:num}. The
{opt truncate} option cannot be used without specifying the {opt label}
option. The {opt truncate} option does not change the groups that are
formed; it changes only their labels.
{opth iqr(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
creates a constant (within {it:varlist}) containing the interquartile range of
{it:exp}. Also see {cmd:pctile()}.
{opth kurt(varname)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
returns the kurtosis (within {it:varlist}) {it:varname}.
{opth mad(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
returns the median absolute deviation from the median (within {it:varlist})
of {it:exp}.
{opth max(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
creates a constant (within {it:varlist}) containing the maximum value
of {it:exp}.
{opth mdev(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
returns the mean absolute deviation from the mean (within {it:varlist})
of {it:exp}.
{opth mean(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
creates a constant (within {it:varlist}) containing the mean of
{it:exp}.
{opth median(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
creates a constant (within {it:varlist}) containing the median of
{it:exp}. Also see {opt pctile()}.
{opth min(exp)}{right:(allows {cmd:by} {varlist}{cmd::}) }
{pmore2}
creates a constant (within {it:varlist}) containing the minimum value
of {it:exp}.
{opth mode(varname)} [{cmd:,} {opt min:mode} {opt max:mode} {opt num:mode}{cmd:(}{it:integer}{cmd:)} {opt miss:ing}] {right:(allows {cmd:by} {varlist}{cmd::}) }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -