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

📄 label.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 28mar2005}{...}
{cmd:help label} {right:dialogs:  {dialog label_data:data}  {dialog labeldefine_dlg:define}  {dialog label_drop:drop}  {dialog label_list:list}}
{right:{dialog label_save:save}  {dialog label_values:values}  {dialog label_variable:variable}{space 2}}
{hline}

{title:Title}

{p2colset 5 18 20 2}{...}
{p2col :{hi:[D] label} {hline 2}}Manipulate labels{p_end}
{p2colreset}{...}


{title:Syntax}

{phang}Label dataset

{p 8 15 2}
{opt la:bel} {opt da:ta} [{cmd:"}{it:label}{cmd:"}]

{phang}Label variable

{p 8 15 2}
{opt la:bel} {opt var:iable} {it:varname} [{cmd:"}{it:label}{cmd:"}]

{phang}Define value label

{p 8 15 2}
{opt la:bel} {opt de:fine} {it:lblname #}
{cmd:"}{it:label}{cmd:"} [{it:#} {cmd:"}{it:label}{cmd:"} {it:...}]
[{cmd:,} {opt a:dd} {opt modify} {opt nofix}]

{phang}Assign value label to variable

{p 8 15 2}
{opt la:bel} {opt val:ues} {it:varname} [{it:lblname}] [{cmd:,} {cmd:nofix}]

{phang}List names of value labels

{p 8 15 2}
{opt la:bel} {opt di:r}

{phang}List names and contents of value labels

{p 8 15 2}
{opt la:bel} {opt l:ist} [{it:lblname} [{it:lblname ...}]]

{phang}Drop value labels

{p 8 15 2}
{opt la:bel} {opt drop} {c -(}{it:lblname} [{it:lblname ...}] | {cmd:_all}{c )-}

{phang}Save value labels as do-files

{p 8 15 2}
{opt la:bel} {opt save} [{it:lblname} [{it:lblname...}]]
{bf:{help using}} {it:filename} [{cmd:,} {opt replace} ]


{phang}Labels for variables and values in multiple languages

        {opt la:bel} {opt lang:uage} ... {right:(see {helpb label language})  }

{phang}
where {it:#} is an integer or an extended missing value code
({cmd:.a}, {cmd:.b}, ..., {cmd:.z}).


{title:Description}

{pstd}
{cmd:label data} attaches a label (up to 80 characters) to the dataset in
memory.  Dataset labels are displayed when you {helpb use} the dataset and when
you {helpb describe} it.  If no label is specified, any existing label is
removed.

{pstd}
{cmd:label variable} attaches a label (up to 80 characters) to a variable.
If no label is specified, any existing variable label is removed.

{pstd}
{cmd:label define} defines a list of up to 65,536 (1,000 for Small Stata)
associations of integers and text called value labels.  Value labels are
attached to variables by {cmd:label values}. 

{pstd}
{cmd:label values} attaches a value label to a variable.  If no value label
is specified, any existing value label is detached from that variable.  The
value label, however, is not deleted.  Value labels may be up to 32,000
characters long.

{pstd}
{cmd:label dir} lists the names of value labels stored in memory.

{pstd}
{cmd:label list} lists the names and contents of value labels stored in
memory.

{pstd}
{cmd:label drop} eliminates value labels.

{pstd}
{cmd:label save} saves value labels in a do-file.  This is particularly useful
for value labels that are not attached to a variable because these labels are
not saved with the data.

{pstd}
See {helpb label language} for information on the {cmd:label language}
command.


{title:Options}

{phang}
{opt add} allows you to add {it:#} to {it:label} correspondences to
{it:lblname}.  If {cmd:add} is not specified, you may create only new
{it:lblnames}.  If {cmd:add} is specified, you may create new {it:lblnames} or
add new entries to existing {it:lblnames}.

{phang}
{opt modify} allows you to modify or delete existing {it:#} to {it:label}
correspondences and add new correspondences.  Specifying {opt modify} implies
{opt add}, even if you do not type the {opt add} option.

{phang}
{opt nofix} prevents display formats from being widened according to the
maximum length of the value label.  Consider 
{opt label values myvar mylab},  and say that {opt myvar} has a 
{opt %9.0g} display format right now.  Say that the maximum length of the
strings in {opt mylab} is 12 characters.  {opt label values} would change the
format of {opt myvar} from {opt %9.0g} to {opt %12.0g}.  {opt nofix} prevents
this.

{pmore}
{opt nofix} is also allowed with {opt label define}, but it is relevant only
when you are modifying an existing value label.  Without the {opt nofix}
option, {opt label define} finds all the variables that use this value label
and considers widening their display formats.  {opt nofix} prevents this.

{phang}
{opt replace} allows {it:filename} to be replaced if it already exists.


{title:Technical note}

{pstd}
Although we tend to show examples defining value labels using one command,
such as

{phang2}{cmd:. label define answ 1 yes 2 no}

{pstd}
remember that value labels may include many associations and typing them
all on one line can be ungainly or impossible.  For instance, if perhaps we
have an encoding of 1,000 places, we could imagine typing

{phang2}{cmd:. label define fips 10060 "Anniston, AL" 10110 "Auburn, AL"}
	{cmd:10175 "Bessemer, AL"} {it:...} {cmd:560050 "Cheyenne, WY"}

{pstd}
In fact, however, the line would be too long.  The line would be 21,182
characters in length and the maximum allowed length of a single line in
Stata is 18,648.  In any case, even in an editor, we would be unlikely to type
the line correctly.

{pstd}
The easy way to enter long value labels is to enter the codings one at a
time:

{phang2}{cmd:. label define fips 10060 "Anniston, AL"}{p_end}
{phang2}{cmd:. label define fips 10175 "Bessemer, AL", add}{p_end}
	{it:...}
{phang2}{cmd:. label define fips 560050 "Cheyenne, WY", add}

{pstd}
And, of course, we could abbreviate:

{phang2}{cmd:. lab def fips 10060 "Anniston, AL"}{p_end}
{phang2}{cmd:. lab def fips 10175 "Bessemer, AL", add}

{pstd}
Up to 65,536 associations are allowed, but defining a value label with that
many associations takes a lot of computer time:

{center:  Number of            total        }
{center:associations     time on 120 MHz PC }
{center:{hline 36}}
{center:     100         less than .01 secs.}
{center:   1,000         0 mins.  0.4  secs.}
{center:   5,000         0 mins. 13    secs.}
{center:  10,000         0 mins. 52    secs.}
{center:  20,000         3 mins. 35    secs.}
{center:  30,000         8 mins. 10    secs.}
{center:  40,000        14 mins. 34    secs.}
{center:  50,000        22 mins. 48    secs.}
{center:  65,536        39 mins. 24    secs.}
{center:{hline 36}}

{pstd}
For instance, if we define a value label with 5,000 associations, on a 120
MHz PC, it will take roughly 13 cpu seconds whether we define the association
on a single line, on 5,000 separate lines, or use the {helpb encode} command.

{pstd}
Once the value label is defined, Stata will be able to look up values in
the label (to determine, for instance, that 560050 means "Cheyenne, WY")
almost instantly.


{title:Examples}

{phang}{cmd:. label data "in process counts"}

{phang}{cmd:. label variable mpg "miles per gallon"}

{phang}{cmd:. label define yesno 0 no 1 yes}{p_end}
{phang}{cmd:. label values answer yesno}{p_end}
{phang}{cmd:. label define yesno 3 "perhaps", add}{p_end}
{phang}{cmd:. label define yesno 3 "maybe", modify}

{phang}{cmd:. label define codes 1 low 2 medium 3 high .a "unsure" .b "won't tell"}{p_end}
{phang}{cmd:. label values myvar codes}


{title:Also see}

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

{psee}
Online:  {helpb encode}, {helpb label language},
{helpb labelbook}
{p_end}

⌨️ 快捷键说明

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