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, statalist.org 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 <nakashimapedrolist@gmail.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index