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

📄 encode.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 24feb2005}{...}
{cmd:help encode}, {cmd:help decode}{right:dialogs:  {bf:{dialog encode}}  {bf:{dialog decode}}}
{hline}

{title:Title}

{p2colset 5 19 21 2}{...}
{p2col :{hi:[D] encode} {hline 2}}Encode string into numeric and vice versa{p_end}
{p2colreset}{...}


{title:Syntax}

{phang}
String variable to numeric variable

{p 8 16 2}
{opt en:code} {it:varname} {ifin} {cmd:,} {opth g:enerate(newvar)}
[{opt l:abel}{cmd:(}{it:name}{cmd:)} {opt noe:xtend}]

{phang}
Numeric variable to string variable

{p 8 16 2}
{opt dec:ode} {it:varname} {ifin} {cmd:,} {opth g:enerate(newvar)}
[{opt maxl:ength}{cmd:(}{it:#}{cmd:)}]


{title:Description}

{pstd}
{cmd:encode} creates a new variable named {newvar} based on the string
variable {varname}, creating, adding to, or just using (as necessary) the
value label {it:newvar} or, if specified, {it:name}.  Do not
use {cmd:encode} if {it:varname} contains numbers that merely happen to be
stored as strings; instead, use
{cmd:generate} {it:newvar} {cmd:=} {opt real(varname)} (see {helpb real()})
or {helpb destring}.

{pstd}
{cmd:decode} creates a new string variable named {it:newvar} based on the
"encoded" numeric variable {it:varname} and its value label.


{title:Options for encode}

{phang}
{opth generate(newvar)} is required and specifies the name of the variable to
be created.

{phang}
{opt label(name)} specifies the name of the value label to be created or used
and added to if the named value label already exists.  If {opt label()} is not
specified, {cmd:encode} uses the same name for the label as it does
for the new variable.

{phang}
{opt noextend} specifies that if there are values contained in {it:varname}
that are not present in {opt label(name)}, {it:varname} not be encoded.  By
default, any values not present in {opt label(name)} will be added to that
label.


{title:Options for decode}

{phang}
{opth generate(newvar)} is required and specifies the name of the variable to
be created.

{phang}
{opt maxlength(#)} specifies how many characters of the value label to retain;
{it:#} must be between 1 and 244 for Stata/SE and between 1 and 80 for
Intercooled Stata and Small Stata.  The default is 244 for Stata/SE and 80 for
Intercooled Stata and Small Stata.


{title:Remarks}

{pstd}
If a large number of value labels are created by {cmd:encode}, the command may
take a significant amount of time to run.  See the technical note in 
{helpb label} for details.


{title:Examples}

{phang}{cmd:. anova y a b a*b}{p_end}
      {txt:no observations}{space 5}(because {cmd:a} and {cmd:b} are string variables)

{phang}{cmd:. encode a, gen(A)}

{phang}{cmd:. encode b, gen(B)}

{phang}{cmd:. anova y A B A*B}{p_end}
      (output appears)

{phang}{cmd:. decode tcode, gen(treat)}

{phang}{cmd:. drop tcode}

{phang}{cmd:. append using newdata}

{phang}{cmd:. encode treat, gen(tcode)}

{phang}{cmd:. drop treat}


{title:Also see}

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

{psee}
Online:  {helpb compress}, {helpb destring}, {helpb generate}
{p_end}

⌨️ 快捷键说明

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