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]

Re: st: Problem with gen command?


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Problem with gen command?
Date   Wed, 7 Aug 2013 19:02:12 +0100

Sure, but this is documented left, right and everywhere. One place is

http://www.stata.com/help.cgi?precision

It's unfortunate that people are unwilling or too busy to read the
documentation, but that is not the fault of StataCorp. Not the fault
of Statalist, either, not that that is claimed here. Goodness know how
many posts have covered this over the years.

In essence, Stata not notifying you of the small degradation is a
compliment, not an insult. The presumption is that you know what you
are asking and Stata obliges. That may seem an odd way to work, but
would you rather that Stata constantly assumed the opposite.

Specifically, in this case -clonevar- exists as a way of ensuring
exact copies of variables.

Nick
Nick
[email protected]


On 7 August 2013 18:51, Stuart Buck <[email protected]> wrote:
> Just passing this along from a fellow researcher:
>
> Be careful with the stata gen command.
>
> I came across something concerning in stata which I wanted to share.
> I imported some NCES data which brought the ncesid in as a double
> numeric variable.  I wanted to make a duplicate of the ncesid so I
> could do some manipulation without having to preserve/restore or
> reload the data.  When I used: gen ncesid2=ncesid, the values created
> were a float numeric variable and were not equal to those in the
> ncesid variable.
>
> One of my coworkers and I figured out this was because the float type
> only used 4 bytes so it holds less information than the double type (8
> bytes).  Stata was changing the last few numbers in ncesid2 in order
> to make it fit in the 4 bytes allocated to a float.  The big problem
> is that Stata does not give any notice when it does this. Further, if
> values are being shown in scientific notation, you may not be able to
> see the difference even if you put them side by side.
>
> --
> Stuart Buck
> http://about.me/stuartbuck
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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