Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Factor variables


From   "Alistair Windsor (U of M)" <alistair.windsor@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Factor variables
Date   Wed, 28 Sep 2011 18:38:20 -0500

Dear Statalisters,

I am attempting to convert some of my user written programs to allow factor variables.

The first thing that I ran into is that you cannot use a varlist expanded by fvexpand in a foreach ... of varlist loop. Took me a while to work out that you can still iterate over the list by change your foreach .... of varlist to a foreach ... in loop. This switch should not cause problems since fvexpand expand ranges.

That this is necessary does not seem to be documented anywhere.

The next problem I have run into is that you cannot use the individual dummy variables 1.class as dependent variables.

My current solution is to fvexpand the list to get the individual 1.class, 2.class, ..., and n.class dummies. This gives me a list that I can iterate over. Since these cannot be used as dependent variables for each var I produce a new var_clean using fvrevar.

Now I can regress var_clean but use var to label the results.

Am I missing something? Is there an easier way to do this?

I understand why i.class variables cannot be used as dependent variables but not why a specific interaction dummy 2.class variables cannot be used as dependent variables. I think that the standard check rejects them but should not.

Yours,

Alistair

--
--
Alistair Windsor
Assistant Professor
Department of Mathematical Sciences
380 Dunn Hall           Ph: 901-678-4431
University of Memphis   Fax: 901-678-2480
Memphis, TN 38152-3240
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index