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

📄 _labels2names.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 10mar2005}{...}
{cmd:help _labels2names}{right:also see:  {help undocumented}}
{hline}

{title:Title}

{p 4 23 2}
{hi:_labels2names} {hline 2} Using value labels as Stata names


{title:Syntax}

{phang2}
{cmd:_labels2names}
	[{varname}]
	{ifin}
	[{cmd:,}
		{opt m:issing} 
		{opt nolab:el}
		{opt stub(name)}
		{opt i:ndexfrom(#)}
		{opt noint:egers}
		{opt renum:ber}
		{opt n:amelist(names)}
	]


{title:Description}

{pstd}
{cmd:_labels2names} is a programmers tool that constructs Stata names for each
unique value of the categorical variable {it:varname}.  {cmd:_labels2names}
tries to use the value labels attached to {it:varname} to generate names
(identifiers), resorting to the value (if it is a non-negative integer) or a
default name when the labels are not valid Stata names;
see {helpb syntax}.

{pstd}
{cmd:_labels2names} will ignore value labels that happen to be non-negative
integers, unless the {opt renumber} option is specified.


{title:Options}

{phang}
{cmd:missing} indicates that missing values are to be treated as valid
categories.

{phang}
{cmd:nolabel} causes {cmd:_labels2names} to ignore value labels attached to
{it:varname}.

{phang}
{cmd:stub(name)} specifies a stub for default name generation in cases where a
label is not a valid Stata name.  The default names are of the form
{it:name#}, where {it:#} is the index for the default name.

{phang}
{cmd:indexfrom(#)} specifies that the default names are to be indexed starting
from {it:#} instead of 1.

{phang}
{cmd:nointegers} prevents {cmd:_labels2names} from accepting non-negative
integer values as valid names.

{phang}
{cmd:renumber} allows non-negative integer value labels to remap the values
they represent.

{phang}
{cmd:namelist(names)} specifies an exclusion list; names that are not allowed.


{title:Examples}

    {cmd}. sysuse auto, clear
    {txt}(1978 Automobile Data)
    
    {cmd}. _labels2names foreign
    {txt}
    {cmd}. sreturn list
    
    {txt}macros:
             s(indexfrom) : "{res}3{txt}"
                s(labels) : "{res}Domestic Foreign{txt}"
              s(namelist) : "{res}Domestic Foreign{txt}"
                 s(names) : "{res}Domestic Foreign{txt}"
                 s(n_cat) : "{res}2{txt}"
    
    {cmd}. label define badlabs 1 "first cat" 2 "not.a.name" 3 "4" 4 "four"
    {txt}
    {cmd}. label val rep badlabs
    {txt}
    {cmd}. _labels2names rep, stub(mystub) index(3)
    {txt}
    {cmd}. sreturn list
    
    {txt}macros:
             s(indexfrom) : "{res}8{txt}"
                s(labels) : "{res}`"first cat"' not.a.name 4 four 5{txt}"
              s(namelist) : "{res}mystub3 mystub4 mystub5 four 5{txt}"
                 s(names) : "{res}mystub3 mystub4 mystub5 four 5{txt}"
                 s(n_cat) : "{res}5{txt}"


{title:Saved results}

{pstd}
{cmd:_labels2names} saves in {cmd:s()}:

{p2colset 9 25 32 2}{...}
{pstd}Macros:{p_end}
{p2col :{cmd:s(n_cat)}}number of categories in {it:varname}{p_end}
{p2col :{cmd:s(names)}}names generated from {it:varname}{p_end}
{p2col :{cmd:s(namelist)}}{it:names}
	from {opt namelist()} option with {cmd:s(names)} appended, for
	subsequent calls{p_end}
{p2col :{cmd:s(labels)}}label
	associated with each name in {cmd:s(names)}{p_end}
{p2col :{cmd:s(indexfrom)}}new
	value for {opt indexfrom()} option on subsequent calls{p_end}
{p2colreset}{...}


{title:Also see}

{psee}
Online:  {helpb syntax}
{p_end}

⌨️ 快捷键说明

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