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: Re: Stata cannot do math?

From   "Joseph Coveney" <>
To   <>
Subject   st: Re: Stata cannot do math?
Date   Thu, 19 May 2011 09:19:35 +0900

Yu Xue wrote:

This may be a stupid question. Here are the command and Stata output:

.set obs 50
.gen a=100.1
.count if a==100.1
.tab a
.sum a
variable  obs  mean  s.d.  min    max
a            50    100.1  0    100.1  100.1
.gen b=a-100
.tab b

So, Stata shows that a is equal to 100.1, but actually, it is equal to

Can anyone explain to me what this is? Do I have to set precision when
I do math in Stata? How to set precision?


At Stata's command prompt, type:

findit precision

and then croll through the results to the half-dozen online FAQs and _Stata
Journal_ articles for some suggestions, in particular the use of the -float()-

Yours not a stupid question, but it is a common one.  In general, when you have
basic questions like that, it's often a good idea (that is, it's quicker than
Stata List) to use -findit- or -search- at the command prompt to see whether
others have had the same problem.

Joseph Coveney

*   For searches and help try:

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