Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Defining Value labels from string values, not like -sencode-
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Defining Value labels from string values, not like -sencode-
Date
Tue, 30 Apr 2013 15:33:51 +0100
Check out -labmask- from SJ.
FAQ . How to assign the val. of a var. as the val. labels of another var.
. . . . . . . . . . . . . . . . . . UCLA Academic Technology Services
7/08 http://www.ats.ucla.edu/stat/stata/faq/labmask.htm
SJ-8-2 gr0034 . . . . . . . . . . Speaking Stata: Between tables and graphs
(help labmask, seqvar if installed) . . . . . . . . . . . . N. J. Cox
Q2/08 SJ 8(2):269--289
outlines techniques for producing table-like graphs
Nick
[email protected]
On 30 April 2013 15:29, Pedro Nakashima <[email protected]> wrote:
> Dear users,
>
> I'm looking for a way to transform a string variable (in the example
> below, strvar) in float variable, with the same value labels as the
> former string variable, as does the command -sencode-.
>
> However, I do not want the values of the value labels 1,2,3 .... n, as
> -sencode- does.
>
> I would like the numbers to be the same as of another variable (in the
> example below, variable "values"), eg:
>
> clear
> input str4 strvar float values
> "adm" +1
> "desl" -1
> end
> sencode strvar, replace
> replace strvar = -1 if strvar == 2
> labmm strvar 1 "adm" -1 "desl"
>
>
> ps: here, -sencode- and -labmm- are from ssc (the later, is part of -labutil2-)
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/