Bookmark and Share

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]

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


From   Pedro Nakashima <[email protected]>
To   [email protected]
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:

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-)

Thank you for any help

Pedro Nakashima.
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index