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

st: RE: outsheet - insheet


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: outsheet - insheet
Date   Sun, 16 May 2004 19:25:41 +0100

I guess that everything here hinges on the fact that -outsheet- 
emits decimal representations of what are held internally 
within Stata as binary numbers. See [U] 16.10 as normal. 

Also, I think it's fair to say that -outsheet- is not 
best suited for this purpose. 

If you can get your mainframe to read in hexadecimal, then 
formatting your non-integers as %21x will I think reduce
the problem. A customised program using -file- might 
be another possibility. 

Nick 
[email protected] 

Sascha O. Becker
 
> in a project, we have to -outsheet- a Stata data set, and after some 
> intermediate steps on a mainframe computer, -insheet- the data again.
> 
> When doing some tests with -outsheet- and -insheet- it turns out that 
> after insheeting variables and comparing them to the original 
> variables 
> using Stata's -compare-, values differ. Here is what I do:
> 
> ***
> /* data set contains variables var1 and id */
> save using original.dta
> outsheet using test.csv, comma
> insheet using test.csv, clear
> rename var1 var1_new
> merge id using original
> compare var1 var1_new;
> 
>                                      ---------- difference ----------
>                          count       minimum      average     maximum
> --------------------------------------------------------------------
> var1<var1_new          89433     -.0005035     -.000129   -7.45e-09
> var1=var1_new           6097
> var1>var1_new          89019      7.45e-09     .0001295    .0005035
>                     ----------
> jointly defined        184549     -.0005035    -7.35e-08    .0005035
>                     ----------
> total                  184549
> ***
> 
> Admittedly, the differences are not large. Is there a way to 
> make sure 
> values do NOT change AT ALL after outsheet - insheet?
> 
> One remark: the problem only seems to come up with floats and doubles 
> but not with integers.
> 
> Does -outsheet- work for integers (and bytes) only?
> 

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