Although Nick Cox is certainly correct in noting that a researcher's
classification of a variable as "discrete" or "continuous" is not one
of Stata's characteristics defining that variable, two things come to
mind:
1) compress will turn a "false float" into an appropriate integer (but
one may not want to routinely compress a data set just to find that
out!)
2) a reasonable approximation to D vs C can be had with a minor mod of
Phil Ryan's code:
webuse auto, clear
foreach var of varlist _all {
local ty : type `var'
if index("`ty'","str") == 0 {
capt assert `var' - int(`var') == 0 if `var' < .
local wh = cond(_rc>0,"Continuous","Discrete")
display " `var' " _col(20) "`: type `var''" _col(30) "`wh'"
}
}
price int Discrete
mpg int Discrete
rep78 int Discrete
headroom float Continuous
trunk int Discrete
weight int Discrete
length int Discrete
turn int Discrete
displacement int Discrete
gear_ratio float Continuous
foreign byte Discrete