| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Continuous vs discrete variables.
My consolation is that my proposition is a little bit more elegant than
the Stas's one, because I use "else" and "QUI inspect" !!
Jean-Benoit
Jean-Benoit Hardouin a �crit :
Oups, Stas is the faster ! :o)
Jean-Benoit
Jean-Benoit Hardouin a �crit :
Salut Amadou,
A solution is to use -inspect- and to use r(N_unique) which contains
the number of modalities (without "missing values").
For example :
unab varlist: *
local binary
local categorical
local numerous
foreach i of varlist `varlist' {
qui inspect `i'
if `r(N_unique)'==2 {
local binary `binary' `i'
}
else if `r(N_unique)'<5 {/*or to an other value*/
local categorical `categorical' `i'
}
else {
local numerous `numerous' `i'
}
}
di "`binary'"
di "`categorical'"
di "`numerous'"
Best,
Jean-Benoit
[email protected] a �crit :
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/
*
* 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/
*
* 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/
*
* 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/