Bookmark and Share

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

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

st: AW: Extra decimal places?

From   "Martin Weiss" <>
To   <>
Subject   st: AW: Extra decimal places?
Date   Tue, 8 Jun 2010 17:44:23 +0200


Same reasoning as in Nick`s 

When I use -double- as data type, as Maarten said, the numbers are correct
after -xmlsave-ing and opening in spreadsheet software...

set obs 100
gen id=  _n+.3
gen double id2=  _n+.3
xmlsave "myxmlfile", doctype(excel) replace


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Devora Shamah
Gesendet: Dienstag, 8. Juni 2010 17:27
Betreff: st: Extra decimal places?

Hello All,

I am having an issue with Stata adding places to decimal values. I am using
Stata 11.0. I have several datasets that I pulled from Access using
StatTransfer. In preparation to append and merge the datasets I added a
decimal number to the id codes based on the school id to ensure that id was
unique across all the datasets. 

For example:
gen id=  ApplicationTableID+.3

id is a numeric variable, formatted as %9.0g

I have discovered that although the id numbers all read X.3, the actual
values range from X.29999 -X.3002 which shows up when we move the data into
excel and on some of the tables.

The files have been compressed, and reshaped. Does anyone know why Stata
assigns varying values across the observations?



Devora Shamah, Ph.D.
Manager, Research and Reporting

Gateway to College National Network
529 SE Grand Ave. #300
Portland, OR 97214
phone: 971.634.1203
fax: 971.634.1213

*   For searches and help try:

*   For searches and help try:

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