At 04:44 PM 10/6/2008, Jacob A. Wegelin wrote:
I would like to check for type of variable (string, numeric, etc) in
a program, and then take action on the basis of the type. [...]
How about...
local typ: type varname
then test whether substr("`typ'" , 1, 3) == "str"
You can be more concise by compressing this into one expression:
substr("`:type varname'" , 1, 3) == "str"
And of course, substitute `1' for varname in your program.
HTH
--David
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/