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

📄 collapse.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* *! version 1.0.0  10jun2005}{...}
{cmd:help collapse}{right:dialog:  {bf:{dialog collapse}}}
{hline}

{title:Title}

{p2colset 5 21 23 2}{...}
{p2col :{hi:[D] collapse} {hline 2}}Make dataset of summary datasets{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 17 2}
{cmd:collapse}
{it:clist}
{ifin}
{weight}
[{cmd:,} {it:{help collapse##options:options}}]

{pstd}where {it:clist} is either

{p 8 17 2}
[{opt (stat)}]
{varlist}
[ [{opt (stat)}] {it:...} ]{p_end}

{p 8 17 2}
[{opt (stat)}] {it:target_var}{cmd:=}{varname}
        [{it:target_var}{cmd:=}{it:varname} {it:...}]
        [ [{opt (stat)}] {it:...}]

{p 4 4 2}or any combination of the {it:varlist} or {it:target_var} forms, and
{it:stat} is one of{p_end}

{p2colset 9 20 22 2}{...}
{p2col :{opt mean}}means (default){p_end}
{p2col :{opt sd}}standard deviations{p_end}
{p2col :{opt sum}}sums{p_end}
{p2col :{opt rawsum}}sums, ignoring optionally specified weight{p_end}
{p2col :{opt count}}number of nonmissing observations{p_end}
{p2col :{opt max}}maximums{p_end}
{p2col :{opt min}}minimums{p_end}
{p2col :{opt iqr}}interquartile range{p_end}

{p2col :{opt median}}medians{p_end}
{p2col :{opt p1}}1st percentile{p_end}
{p2col :{opt p2}}2nd percentile{p_end}
{p2col :{it:...}}3rd{hline 1}49th percentiles{p_end}
{p2col :{opt p50}}50th percentile (same as {cmd:median}){p_end}
{p2col :{it:...}}51st{hline 1}97th percentiles{p_end}
{p2col :{opt p98}}98th percentile{p_end}
{p2col :{opt p99}}99th percentile{p_end}
{p2colreset}{...}

{pstd}
If {it:stat} is not specified, {opt mean} is assumed.

{synoptset 15 tabbed}{...}
{marker options}{...}
{synopthdr}
{synoptline}
{syntab :Options}
{synopt :{opth by(varlist)}}groups over which {it:stat} is to be calculated
{p_end}
{synopt :{opt cw}}casewise deletion instead of all possible observations
{p_end}

{p2coldent :+ {opt fast}}do not restore the original dataset should the
user press {hi:Break}; programmer's command{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
+ {opt fast} is not shown in the dialog box.{p_end}
{p 4 6 2}
{it:varlist} and {it:varname} in {it:clist} may contain time-series operators; see {help tsvarlist}.{p_end}
{p 4 6 2}
{opt aweight}s, {opt fweight}s, {opt iweight}s, and {opt pweight}s are allowed; see {help weight}, and see {help collapse##Weights:Weights} below.  {opt pweight}s may not be used with statistic {opt sd}.{p_end}


{title:Description}

{pstd}
{opt collapse} converts the dataset in memory into a dataset of means, sums,
medians, etc.  {it:clist} must refer to numeric variables exclusively.

{pstd}
Note: See {helpb contract} if you want to collapse to a dataset of
frequencies.


{title:Options}

{dlgtab:Options}

{phang}
{opth by(varlist)} specifies the groups over which the means, etc., are to be
calculated.  If this option is not specified, the resulting dataset will
contain one observation.  If it is specified, {it:varlist} may refer to either
string or numeric variables.

{phang}
{opt cw} specifies casewise deletion.  If {opt cw} is not specified, all
possible observations are used for each calculated statistic.

{pstd}The following option is available with {opt collapse} but is not shown
in the dialog box:

{phang}
{opt fast} specifies that {opt collapse} not restore the original dataset
should the user press {hi:Break}.  {opt fast} is intended for use by
programmers.


{marker Weights}{...}
{title:Weights}

{pstd}
{opt collapse} allows all four weight types; the default is {opt aweight}s.
Weight normalization impacts only
the {opt sum}, {opt count}, and {opt sd} statistics.

{pstd}
Here are the definitions for {opt count} and {opt sum} with weights:

{p2colset 9 39 41 2}{...}
{p2col 6 39 41 2 :{opt count}:}{p_end}
{p2col :unweighted}the number of physical observations{p_end}
{p2col :{opt aweight}:}the number of physical observations{p_end}
{p2col :{opt fweight, iweight, pweight}:}the sum of user-specified weights{p_end}
{p2col 6 39 41 2 :{opt sum}:}{p_end}
{p2col :unweighted}the sum of the variable{p_end}
{p2col :{opt aweight}:}sum(vj*xj); vj = weights normalized to sum to _N{p_end}
{p2col :{opt fweight, iweight, pweight}:}sum(wj*xj); wj = user supplied weights.{p_end}

{pstd}
The {opt sd} statistic with weights returns the bias-corrected standard
deviation, which is based on the factor sqrt(N/(N-1)), where N is the number
of observations.  {opt sd} is not allowed with {opt pweight}ed data.
Otherwise {opt sd} is changed by the weights through the computation of the
count (N), as outlined above.

{pstd}
For instance, consider a case in which there are 25 physical observations in
the dataset and a weighted variable that sums to 57.  In the unweighted case,
the weight is not specified, and N = 25.  In the analytically weighted case,
N is still 25; the scale of the weight is irrelevant.  In the
frequency-weighted case, however, N = 57, the sum of the weights.

{pstd}
The {opt rawsum} statistic with {opt aweight}s ignores the
weight, with one exception:
observations with zero weight will not be included in the sum.


{title:Examples}

{phang}{cmd:. collapse age educ income, by(state)}

{phang}{cmd:. collapse (mean) age educ income, by(state)}

{phang}{cmd:. collapse (median) age educ income, by(state)}

{phang}{cmd:. collapse (mean) age educ (median) income, by(state)}

{phang}{cmd:. collapse (mean) age educ income (median) medinc=income, by(state)}

{phang}{cmd:. collapse (mean) age-income (median) medinc-income medage=age, by(state)}

{phang}{cmd:. collapse (mean) age educ income (median) medinc=income, by(state) cw}

{phang}{cmd:. collapse (mean) age-income (median) medage=age [w=pop], by(region)}


{title:Also see}

{psee}
Manual:  {bf:[D] collapse}

{psee}
Online:  {helpb contract},
{helpb egen},
{helpb statsby},
{helpb summarize}
{p_end}

⌨️ 快捷键说明

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