Reputation: 317
I am trying to drop
a specific observation with the code below:
drop if (importus==6.4e+06 & country =="Congo, Dem. Rep.")
The code produces no errors but it is not dropping the observation due to the scientific notation and it works with smaller numbers as in:
drop if (importus==75990 & country =="Chad")
Is there a way in Stata to convert all numeric variables to display more numbers as opposed to scientific notation?
Upvotes: 0
Views: 11866
Reputation: 37208
A short answer to the question is to use format
to change the display format. It is quite rare that all numeric variables are best displayed with the same format.
The display format is, however, a side-issue to your question. If and only if the value in question is 6400000 then drop if importus==6.4e+06
or drop if importus==6400000
should both work (setting aside the other condition).
If the drop
doesn't work as you expect, the likely explanation is that the value in question is not 6400000, but something close. Now the format may be pertinent. A sensible format for your variable depends on its resolution. If it is integer-valued then
. format importus %12.0f
is the kind of command you could try before using say edit
or list
to inspect the data. help format
leads to more information.
As a matter of good practice in an audit trail, a value being 6400000 (or whatever it is exactly) is not an obvious reason why an observation should be drop
ped. There could be (should be?) a better or more obvious reason why it should be drop
ped which would make for clearer syntax.
Upvotes: 2