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

st: RE: data conversion


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: data conversion
Date   Tue, 29 Jun 2004 20:38:29 -0500

You need to specify the format:

gen dob2 = string(dob1, "%10.0g")

or you could use -tostring-

tostring dob1, gen(dob2)

Hope this helps,
Scott


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of M. Nizam Khan
Sent: Tuesday, June 29, 2004 1:20 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: data conversion

Hi Statalister,

I want to convert dob1,which is a numeric variable, into a string variable.
So I created dob2=string(dob1). But, for example, I want to see "dob2"
as "19410700" not "1.94e+07". How can I do it?

               dob1       dob2

               19410700   1.94e+07

Thanks.


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