Statalist


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

st: How to convert multiple numeric variables into a single string variable?


From   [email protected]
To   [email protected]
Subject   st: How to convert multiple numeric variables into a single string variable?
Date   Sun, 7 Oct 2007 12:14:52 -0300 (BRT)

Dear Statalisters,

I would like to know if there is a command in Stata to convert multiple
numeric variables into a single string variable (and vice-versa). For
example, suppose I have the following dataset:

var1 var2 var3
0 2 3
4 5 6
7 8 9

In this respect, I would like to create a new string variable, say, var4,
using the var1, var2 as well as var3. That is:

var1 var2 var3 var4
0 2 3 0_2_3
4 5 6 4_5_6
7 8 9 7_8_9

Finally, I would like to do the inverse process. From:

var1
0_2_3
4_5_6
7_8_9

to

var1 var2 var3 var4
0_2_3 0 2 3
4_5_6 4 5 6
7_8_9 7 8 9

Thank you for any reply.


Best regards,

Tiago



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