Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: RE: AW: AW: Decimal Precision with Destring


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: RE: AW: AW: Decimal Precision with Destring
Date   Mon, 19 Apr 2010 17:14:15 +0200

<> 

"Neither option you've sent are working for me."



What does "not working" mean? Note the FAQ...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Sutton, Bennett
W.
Gesendet: Montag, 19. April 2010 16:47
An: [email protected]
Betreff: st: RE: AW: AW: Decimal Precision with Destring

Many thanks for your suggestions.

Neither option you've sent are working for me.

I'm using stata SE 10.  Is there a setting somewhere which may be
controlling the default decimal precision?


Ben



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Monday, April 19, 2010 10:42 AM
To: [email protected]
Subject: st: AW: AW: Decimal Precision with Destring


<> 

-destring- seems to work as well:


*************
clear*

inp str17 myvar
2.343541098765432
2.398784389359001
3.219439049039405
3.199038538208222
end

destring myvar, gen(mynewvar)
format mynewvar %18.0g
l, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Montag, 19. April 2010 16:31
An: [email protected]
Betreff: st: AW: Decimal Precision with Destring


<> 

This code does seem to work, using your second approach:

*************
clear*

inp str17 myvar
2.343541098765432
2.398784389359001
3.219439049039405
3.199038538208222
end

list, noo

gen double mynewvar=real(myvar)
format mynewvar %18.0g
l, noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Sutton, Bennett
W.
Gesendet: Montag, 19. April 2010 16:25
An: [email protected]
Betreff: st: Decimal Precision with Destring

Hello all,

I found one post on this from 5 years ago.  But no resolution to the issue
was posted.  Wondering if anyone has since encountered and surmounted this
problem:

I am insheet-ing a .csv file with decimal precision set at 15 places in
excel.  But after insheeting into stata, the series are data type double,
but only have precision to 10 places.  I'm working with hyperinflation
countries and the lack of precision is producing some incorrect results in
calculations.

I have also tried reading the data in as string variables which at least
preserves the 15 digit precision, but destring-ing the data results in loss
of precision again to 10 decimal places.

Any known work arounds?

Many thanks!

Ben

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index