I am exporting data into a csv file with the command "export delimited variables using test.csv"
For some reason some of the variables are appearing in the csv file with 14 decimal places.
An example is var1 which has a value (when I list it) of 529.2 in the 9th observation
I have rounded it to 1 decimal place using the round function. However in the .csv file it appears as 529.2000000000001
This doesn't happen again with this variable until the 16th and the the 33rd and some subsequent observations but it does occur with other variables. About every 3rd or 4th observation has at least one variable that is written in the .csv file with 13 '0's and a '1' trailing the 'true' value even though none display that way in stata or in the data window. The pattern seems random.
This doesn't effect how the data are read into the subsequent program but I would like to know how I can control the formats in the export file. All the variables are stored as double and displayed as %12.0g or %9.0f
Martin
For some reason some of the variables are appearing in the csv file with 14 decimal places.
An example is var1 which has a value (when I list it) of 529.2 in the 9th observation
I have rounded it to 1 decimal place using the round function. However in the .csv file it appears as 529.2000000000001
This doesn't happen again with this variable until the 16th and the the 33rd and some subsequent observations but it does occur with other variables. About every 3rd or 4th observation has at least one variable that is written in the .csv file with 13 '0's and a '1' trailing the 'true' value even though none display that way in stata or in the data window. The pattern seems random.
This doesn't effect how the data are read into the subsequent program but I would like to know how I can control the formats in the export file. All the variables are stored as double and displayed as %12.0g or %9.0f
Martin
Comment