{smcl} {* *! version 1.0.0 12jun2014}{...} {cmd:help mencode} {hline} {title:Title} {p 4 15 2}{cmd:mencode} {hline 2} Encode values using existing string variable as labels{p_end} {title:Syntax} {p 8 16 2} {cmd:mencode} {varname}{cmd:,} {cmdab:labels(}{it:varname}{cmd:)} [{cmd:labelname(}{it:string}{cmd:)} force drop] {title:Description} {pstd}{cmd:mencode} will take an existing string variable, convert it to a label and apply that label to a numeric variable. {title:Arguments} {phang}{opt {varname}} the numeric variable to be labeled {phang}{opt labels(varname)} the string variable containing the labels {title:Options} {phang}{opt labelname(string)} specifies name for the label created during the process. Default is {varname} {phang}{opt force} If {it:labelname} already exists, it will be replaced. {phang}{opt drop} drops the string variable containing the labels {title:Notes} {phang}For {cmd:mencode} to work properly, there must be a 1:1 relationship between the two required variables. The command currently doesn't check to ensure a 1:1 relationship {title:Examples} {p 4 6 2}. mencode statefips, labels(state){p_end} {p 4 6 2}. mencode statefips, labels(state) drop{p_end} {p 4 6 2}. mencode statefips, labels(state) labelname(states) drop{p_end} {title:Author} {pstd}Jeremy Nighohossian{p_end} {pstd}FTI Consulting{p_end}