|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: How to attach a string to a numeric variable as its valuelable
From |
Margaret R Grove <[email protected]> |
To |
[email protected] |
Subject |
Re: st: How to attach a string to a numeric variable as its valuelable |
Date |
Tue, 25 Mar 2008 18:41:10 -0400 |
Is it possible your "x" variable has some extraneous blanks or such?
You might want to try both of the following before doing your encode and
following statements:
replace x=trim(x)
replace x=upper(x)
Meg
Jia Xiangping wrote:
Dear all,
There are two variables, one string and one numeric. The meaning of x
is supposed to be attached to y as its value label.
x y
RAKAI 21
RAKAI 21
RAKAI 21
MASAKA 22
MASAKA 22
MASAKA 22
MASAKA 22
MBALE 23
MBALE 23
MBALE 23
SIRONKO 24
SIRONKO 24
TORORO 25
TORORO 25
BUSIA 26
The simple way I did was:
. encode x, gen(newx)
. replace newx=y
. list newx y
Then it is found some are not replaced. I must read a solution
somewhere, but I can not recall it. Could someone give a quick
solution? Thanks.
newx x
65. | TORORO IGANGA |
66. | WAKISO MAYUGE |
67. | WAKISO MAYUGE |
68. | WAKISO MAYUGE |
69. | WAKISO MAYUGE |
70. | WAKISO MAYUGE |
71. | WAKISO MAYUGE |
72. | 30 JINJA |
73. | 30 JINJA |
74. | 30 JINJA |
75. | 31 KAMULI |
76. | 31 KAMULI |
ps. Stata 10. Windows XP.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/