📄 labelbook.hlp
字号:
{smcl}
{* 24mar2005}{...}
{cmd:help labelbook}{...}
{right:dialogs: {bf:{dialog labelbook}} {bf:{dialog numlabel}} {bf:{dialog uselabel}}}
{hline}
{title:Title}
{p2colset 5 22 24 2}{...}
{p2col :{hi:[D] labelbook} {hline 2}}Label utilities{p_end}
{p2colreset}{...}
{title:Syntax}
{phang}Produce a codebook describing value labels
{p 8 19 2}{cmd:labelbook} [{it:lblname-list}]
[{cmd:,} {it:labelbook_options}]
{phang}Prefix numeric values to value labels
{p 8 18 2}{cmd:numlabel} [{it:lblname-list}]{cmd:,}
{{opt a:dd}|{opt r:emove}} [{it:numlabel_options}]
{phang}Make dataset containing value-label information
{p 8 18 2}{cmd:uselabel} [{it:lblname-list}]
[{cmd:using} {it:filename}] [{cmd:,} {cmd:clear} {opt v:ar}]
{synoptset 19}{...}
{marker labelbook_options}{...}
{synopthdr :labelbook_options}
{synoptline}
{synopt :{opt a:lpha}}alphabetize label mappings{p_end}
{synopt :{opt le:ngth(#)}}check if value labels are unique to length {it:#};
default is {cmd:length(12)}{p_end}
{synopt :{opt li:st(#)}}list maximum of {it:#} mappings; default is
{cmd:list(32000)}{p_end}
{synopt :{opt p:roblems}}describe potential problems in a summary report{p_end}
{synopt :{opt d:etail}}do not suppress detailed report on variables or value
labels {p_end}
{synoptline}
{p2colreset}{...}
{synoptset 19}{...}
{marker numlabels_options}{...}
{synopthdr :numlabels_options}
{synoptline}
{synopt :{opt m:ask(str)}}mask for formatting numeric labels; default mask is
"{it:#}{cmd:.}"{p_end}
{synopt :{opt force}}force adding or removing of numeric labels{p_end}
{synopt :{opt d:etail}}provide details about value labels, where some labels
are prefixed with numbers and others are not{p_end}
{synoptline}
{p2colreset}{...}
{title:Description}
{pstd}
{cmd:labelbook} displays information for the value labels specified or, if
no labels are specified, all the labels in the data.
{pstd}
For multilingual datasets (see {helpb label language}), {cmd:labelbook}
lists the variables to which value labels are attached in all defined
languages.
{pstd}
{cmd:numlabel} prefixes numeric values to value labels. For example, a value
mapping of {cmd:2} -> "{cmd:catholic}" will be changed to {cmd:2} ->
"{cmd:2. catholic}". See option {opt mask} for the different formats. Stata
commands that display the value labels also show the associated numeric
values. Prefixes are removed with the {opt remove} option.
{pstd}
{cmd:uselabel} is a programmer's commands that reads
the value-label information from the currently loaded dataset or from
an optionally specified filename.
{pstd}
{cmd:uselabel} creates a dataset in memory that contains only that value-label
information. The new dataset has four variables named {opt label},
{opt lname}, {opt value}, and {opt trunc}; is sorted by {opt lname value};
and has one observation per mapping. Value labels can be longer than
the maximum string length in Stata; see {help limits}. The new variable
{opt trunc} contains {cmd:1} if the value label is truncated to
fit in a string variable in the dataset created by {cmd:uselabel}.
{pstd}
{cmd:uselabel} complements {cmd:label, save}, which
produces an ASCII file of the variable labels in a format that allows
easy editing of the value-label texts.
{pstd}
Specifying no list or {opt _all} is equivalent to specifying all value labels.
Value-label names may not be abbreviated or specified with wildcards.
{title:Options for labelbook}
{phang}
{opt alpha} specifies that the list of value-label mappings be sorted
alphabetically on label. The default is to sort the list on value.
{phang}
{opt length(#)} specifies the minimum length that {cmd:labelbook} checks
to determine if shortened value labels are still unique. It defaults to
{opt 12}, the width used by most Stata commands. {cmd:labelbook} also reports
whether value labels are unique at their full length.
{phang}
{opt list(#)} specifies the maximum number of value-labels mappings to be
listed. If a value label defines more mappings, a random subset of {it:#}
mappings is displayed. By default, {cmd:labelbook} displays all mappings.
{cmd:list(0)} suppresses the listing of the value-label definitions.
{phang}
{cmd:problems} specifies that a summary report be produced describing
potential problems that were diagnosed:
{p 8 11 2}
1. value label has gaps in mapped values (e.g., values 0 and 2 are labeled,
while 1 is not){p_end}
{p 8 11 2}
2. value label strings contain leading or trailing blanks{p_end}
{p 8 11 2}
3. value label contains duplicate labels, i.e., there are different values
that map into the same string. If the value label has values that are longer
than the maximum string length in Stata (see {help limits}), those values
are truncated to the maximum string length before being tested for
duplicates.{p_end}
{p 8 11 2}
4. value label contains duplicate labels at length 12{p_end}
{p 8 11 2}
5. value label contains numeric -> numeric mappings{p_end}
{p 8 11 2}
6. value label contains numeric -> null string mappings{p_end}
{p 8 11 2}
7. value label is not used by variables{p_end}
{p 8 8 2}
See {help labelbook_problems} for a discussion of these problems and
advice on overcoming them.
{phang}
{opt detail} may only be specified with {opt problems}. It specifies
that the detailed report on the variables or value labels is not suppressed.
{title:Options for numlabel}
{phang}
{opt add} specifies that numeric values be prefixed to value labels. Value
labels that are already {opt numlabeled} (using the same mask) are not
modified.
{phang}
{opt remove} specifies that numeric values be removed from the value labels.
If you added numeric values using a nondefault mask, you must specify the same
mask to remove them. Value labels that are not {opt numlabeled} or are
{opt numlabeled} using a different mask are not modified.
{phang}
{opt mask(str)} specifies a mask for formatting the numeric labels. In the
mask, {it:#} is replaced by the numeric label. The default mask is "{it:#.} "
so that numeric value {opt 3} is shown as "{opt 3.} ". Note that spaces are
relevant. For the mask "[{it:#}]", numeric value {opt 3} would be shown as
"[{opt 3}]".
{phang}
{opt force} specifies that adding or removing numeric labels be performed,
even if some value labels are {opt numlabeled} using the mask and others are
not. In this case, only labels that are not {opt numlabeled} will be
modified.
{phang}
{opt detail} specifies that details be provided about the value labels that
are sometimes, but not always, {opt numlabeled} using the mask.
{title:Options for uselabel}
{phang}
{opt clear} permits the dataset to be created, even if the dataset already in
memory has changed since it was last saved.
{phang}
{opt var} specifies that the varlists using value label {it:vl} be returned in
{opt r(vl)}.
{title:Examples}
{phang}{cmd:. labelbook}
{phang}{cmd:. labelbook sex education agree, alpha}
{phang}{cmd:. labelbook sex education occ agree, problems list(20)}
{phang}{cmd:. label define repair 1 "very poor" 2 "poor" 3 "medium" 4 good 5 "very good"}{p_end}
{phang}{cmd:. label values rep78 repair}{p_end}
{phang}{cmd:. tabulate rep78}{p_end}
{phang}{cmd:. numlabel, add}{p_end}
{phang}{cmd:. tabulate rep78}
{phang}{cmd:. numlabel repair, remove}{p_end}
{phang}{cmd:. numlabel, add mask("[#] ")}
{title:Also see}
{psee}
Manual: {bf:[D] labelbook}
{psee}
Online: {helpb codebook}, {helpb describe},
{helpb encode}, {helpb labels}, {helpb matalabel}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -