see -inspect-. You can get the number of unique values as r(N_unique)
after it, and use that to create your lists:
local binary
local categ
local cont
unab allvar: *
foreach x of varlist `allvar' {
inspect `x'
if r(N_unique) == 2 {
local binary `binary' `x'
}
if r(N_unique) > 2 & r(N_unique)< 10 {
local categ `categ' `x'
}
if r(N_unique) > 9 & r(N_unique) < . {
local cont `cont' `x'
}
}
On 1/20/06, [email protected] <[email protected]> wrote:
>
>
> Maarten wrote:
>
>
>
>
>
> > Amadou:
> > If your discrete variable is consists of zeros and
> > ones, than you usually don't have to. If one
> > variable distinguishes between more than two
> > groups, than you can use -xi- prefix.
>
> -------------------------------------------------------------------------------
>
>
>
> Dear Maarten,
>
> Thanks for answering. Actually, I am not in a regression or summarizing context.
> I have a huge dataset and would like, among other things, to know which
> variables
> are dummies, which are categorical (more than two but countable modalities),
> which
> are discrete type (1,2,3,...) and which are continuous. I want to place each
> group in
> local macros for future use.
> Cheers.
> Amadou.
>
>
> *
> * 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/
>
--
Stas Kolenikov
http://stas.kolenikov.name
*
* 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/