Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Defining Value labels from string values, not like -sencode-

From   Pedro Nakashima <>
Subject   st: Defining Value labels from string values, not like -sencode-
Date   Tue, 30 Apr 2013 11:29:30 -0300

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:

input str4 strvar float values
"adm" +1
"desl" -1
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-)

Thank you for any help

Pedro Nakashima.
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index