Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Factor variables


From   "Alistair Windsor (U of M)" <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index