Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: New values for a value labelled variable,


From   Serguei Kaniovski <[email protected]>
To   [email protected]
Subject   st: RE: RE: New values for a value labelled variable,
Date   Thu, 14 Sep 2006 15:27:52 +0200

The variable MYID contains the values 12, 23, 12, 45, 24, which are labeled as "joe", "mike", "joe", "helen", "tom".

decode myid, gen(MYID)
split MYID, p(-) destring

would work if the values themselves were: "12-joe", "23-mike", "12-joe", "45-helen", "24-tom".

Since names are labels, not values
decode myid, gen(MYID)
split MYID, p(-) destring

generates only one variable containing the labels as values.

Thanks,
Serguei

Serguei Kaniovski schrieb:

Hi all,

I have a variable with (many) value labels, say

12-joe
23-mike
12-joe
45-helen
24-tom
...

I would like to create a new variable with consecutive values assigned to the old labels, e.g.

1-joe
2-mike
1-joe
3-helen
4-tom
...

It is important that the sequence of names is preserved.

Thanks a lot,
Serguei Kaniovski

--
___________________________________________________________________

Austrian Institute of Economic Research (WIFO)

Name: Serguei Kaniovski			P.O.Box 91
Tel.: +43-1-7982601-231			Arsenal Objekt 20
Fax:  +43-1-7989386			1103 Vienna, Austria
Mail: [email protected]

http://www.wifo.ac.at/Serguei.Kaniovski

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index