Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: macro for the type of a variable (string/numeric)


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: macro for the type of a variable (string/numeric)
Date   Mon, 21 Apr 2008 11:19:46 -0400

See the second entry under
help extended_fcn

or try:
sysuse auto
foreach v of varlist _all {
 loc type: type `v'
 di as res "`v'" as txt " is type" as res " `type'"
}

On Mon, Apr 21, 2008 at 11:01 AM, Jacob Wegelin <[email protected]> wrote:
> The following program is a kluge to determine the type of a variable and to
> assign a string to a local macro which tells us the type.  Is there some
> better way? For instance, "return list" after "describe myvar" or "codebook
> myvar" does not tell us this.
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index