Dear Statalisters,
I've imported a large .txt file to Stata using import delimited. The file has a few numeric variables, which are very long (18 digits) so Stata display them as e+ (e.g. 1.23e+17). I wanted these values to display in full so converted them to string, using
tostring(var), gen(newvar) format ("%20.0f")
However, some of the values returned inaccurate. So for instance, the correct value I expected (i.e. what is in the original .txt file) should have been 123456, but in Stata the it becomes 123457. It seems that after being converted they were rounded up somehow. What confuses me is that there's no decimal places, so it shouldn't be rounded up or down.
Could anyone shed any light on what might have happened and how do I fix this issue (i.e. to convert the numeric variables to string but keep the values the same as what they were in the original .txt file)?
Many thanks
Related Posts with tostring does not return correct values
Hausman-test interpretation for RE vs FEHello, I have a queston on how to interpret a Hausman-test. Dependent variable (y) is suffering fro…
How to compute std error for eyex marginReally, really appreciate the article "When I use the eyex option of margins, what is it actually co…
Mixed models repeated measuresHi, I'm trying to find the best model for answering a repeated measures problem. The research quest…
Graphs Unconditional quantile regressionHello, I would like to know if you could help me with the following: I´m running the following unco…
Identify case in GraphEditor ??I'm looking at the trends of my data and want to identify specific cases from the graph that are out…
Subscribe to:
Post Comments (Atom)
0 Response to tostring does not return correct values
Post a Comment