Changing Stata scientific notation to display whole number

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?

36.9k 6 6 gold badges 34 34 silver badges 49 49 bronze badges asked Nov 17, 2020 at 18:19 maldini425 maldini425 317 1 1 gold badge 5 5 silver badges 18 18 bronze badges

Without a data example, the assumption that the data in question are "whole numbers" (integers) isn't self-evident.

Commented Nov 17, 2020 at 19:57

1 Answer 1

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.