Statalist The Stata Listserver


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

Re: st: possible bug in outsheet?


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: possible bug in outsheet?
Date   Mon, 16 Apr 2007 21:57:37 +0900

Adrian Mander wrote:

Is outsheet meant to recast a variable?
See output below.

I think outsheet is looking at the number type of the first cell and in this
case decides that this variable is an integer and hence is truncating
values.

Personally I think Stata should be picking up the format from the
variable because
this behaviour is a little unsound.

--------------------------------------------------------------------------------

It seems to be related more to the display format than to what's in the
first observation.  I don't think that this is a bug, but it might be better
documented in the help file.

Joseph Coveney

. clear

. set seed `=date("2007-04-16", "ymd")'

. set obs 1
obs was 0, now 1

. tempfile tmpfil0

. generate double a = uniform()

. clonevar b = a

. clonevar c = a

. format a b c %18.16f

. list, noobs

 +--------------------------------------------------------------+
 |                  a                    b                    c |
 |--------------------------------------------------------------|
 | 0.6328111810144037   0.6328111810144037   0.6328111810144037 |
 +--------------------------------------------------------------+

. format a %18.16f

. format b %4.2f

. format c %3.1f

. list, noobs

 +---------------------------------+
 |                  a      b     c |
 |---------------------------------|
 | 0.6328111810144037   0.63   0.6 |
 +---------------------------------+

. outsheet using `tmpfil0'

. insheet using `tmpfil0', double clear
(3 vars, 1 obs)

. format a b c %18.16f

. list, noobs

 +--------------------------------------------------------------+
 |                  a                    b                    c |
 |--------------------------------------------------------------|
 | 0.6328111810144037   0.6300000000000000   0.6000000000000000 |
 +--------------------------------------------------------------+

. erase `tmpfil0'

. exit


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