Suppose you want to write a function (or a loop), where you do something to every variable that depends on its type. In matlab, I would use “isnumber”, etc, or just use the function that returns the type of the variable.
I couldn’t find such a function in stata. There is no “isnumeric” or “isfloat” function.
There is an extended function called “type”. This is my prefered way to do it:
local mytype : type myvarname
disp "`mytype'"
They also have “confirm”, which works: