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

📄 levelsof.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 11feb2005}{...}
{cmd:help levelsof}
{hline}

{title:Title}

{p2colset 5 21 23 2}{...}
{p2col :{hi:[P] levelsof} {hline 2}}Levels of variable{p_end}
{p2colreset}{...}


{title:Syntax}

{p 8 17 2}
{cmd:levelsof}
{varname}
{ifin}
[{cmd:,} {it:options}]

{synoptset 21}{...}
{synopthdr}
{synoptline}
{synopt:{opt c:lean}}display string values without compound double quotes{p_end}
{synopt:{opt l:ocal(macname)}}insert the list of values in the local macro {it:macname}{p_end}
{synopt:{opt miss:ing}}include missing values of {varname} in calculation{p_end}
{synopt:{opt s:eparate(separator)}}separator to serve as puncuation for the values of returned list; default is a space{p_end}
{synoptline}
{p2colreset}{...}


{title:Description}

{pstd}
{cmd:levelsof} displays a sorted list of the distinct values of {varname}.


{title:Options}

{phang}
{cmd:clean} displays string values without compound double quotes.
By default, each distinct string value is displayed within compound double
quotes, as these are the most general delimiters.  If you know that the
string values in {it:varname} do not include embedded spaces or embedded
quotes, this is an appropriate option.  {cmd:clean} has no
effect on the display of values from numeric variables.

{phang}
{cmd:local(}{it:macname}{cmd:)} inserts the list of values in
local macro {it:macname} within the calling program's space.  Hence,
that macro will be accessible after {cmd:levelsof} has finished.
This is helpful for subsequent use, especially with {helpb foreach}.

{phang}
{cmd:missing} specifies that missing values of {it:varname}
should be included in the calculation.  The default is to exclude them.

{phang}
{cmd:separate(}{it:separator}{cmd:)} specifies a separator
to serve as punctuation for the values of the returned list.
The default is a space.  A useful alternative is a comma.


{title:Remarks}

{pstd}
{cmd:levelsof} serves two different functions.  Occasionally, it gives a
compact display of the distinct values of {it:varname}.  More commonly, it may
be useful when it is desired to cycle through the distinct values of
{it:varname} with (say) {helpb foreach}.  {cmd:levelsof} leaves behind a list
in {cmd:r(levels)} that may be used in a subsequent command.

{pstd}
{cmd:levelsof} may hit the {help limits} imposed by your Stata.  However,
it is likely to be most useful when the number of distinct values of
{it:varname} is modest.

{pstd}
The terminology of levels of a factor has long been standard in
experimental design.  


{title:Examples}

{phang}{cmd:. levelsof rep78}

{phang}{cmd:. levelsof rep78, sep(,)}

{phang}{cmd:. levelsof rep78, miss}

{phang}{cmd:. levelsof make if foreign}

{pstd}{cmd:. levelsof factor, local(levels)}{break}
{cmd:. foreach l of local levels {c -(}}{break}
{cmd:.{space 8}di "-> factor = `l'"}{break}
{cmd:.}{space 8}{it:whatever}{cmd: if factor == `l'}{break}
{cmd:. {c )-}}

{pstd}Showing value labels when defined:{p_end}
{pstd}{cmd:. levelsof factor, local(levels)}{break}
{cmd:. foreach l of local levels {c -(}}{break}
{cmd:.{space 8}di "-> factor = `: label (factor) `l''"}{break}
{cmd:.}{space 8}{it:whatever}{cmd: if factor == `l'}{break}
{cmd:. {c )-}}


{title:Also see}

{psee}
Manual:  {bf:[P] levelsof}

{psee}
Online:  {helpb foreach}, {help limits};
{helpb codebook}, {helpb inspect}, {helpb tabulate}
{p_end}

⌨️ 快捷键说明

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