Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: combinig two variables into one


From   "Jiang, Tao" <TJiang@air.org>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: combinig two variables into one
Date   Thu, 1 Aug 2002 12:03:56 -0400

how about

gen str80 z=X+" "+string(Y)


-----Original Message-----
From: pgupta@worldbank.org [mailto:pgupta@worldbank.org]
Sent: Thursday, August 01, 2002 11:55 AM
To: Statalist
Subject: st: combinig two variables into one


Hi

I have two variables which I need to use to generate a new variable. to be
more
specific, suppose I have variable X (which is a numeric string) and variable
Y
(which is numeric). the observations are as follows:

X                                      Y

2  23  3000                    2
212343000                   3
2     4       20                 12

and I need to generate a new variable, say Z which looks like

Z
2  23  3000  2
212343000  3
2    4        2012


can someone suggest whats the best way of handling this problem?

Thx
Pooja Gupta


*
*   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/
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index