Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Naming equations when using the ml command


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Naming equations when using the ml command
Date   Thu, 31 Mar 2005 18:35:23 +0100

Indeed. Also this code fragment could bite you

_pecats yourvar
loc catvals = "r(catvals)"
loc j = r(numcats)
forval i = 1/`j' {
	loc val`i': word `i' of `catvals'
}

as the assignment -loc catvals- will 
truncate at 80 or 244 chars, depending 
on your Stata. Copying, not 
assignment, is needed with this route. 

Nick 
n.j.cox@durham.ac.uk 

Richard Williams
 
> At 04:15 PM 3/30/2005 -0600, Jun Xu wrote:
> >Miss the second part. For value lables, you can try Scott 
> Long's _pecats 
> >and get returns from  it. It really depends. If you have 
> fixed number of 
> >equation, then you can set up loops like
> >
> >_pecats yourvar
> >loc catvals = "r(catvals)"
> >loc j = r(numcats)
> >forval i = 1/`j' {
> >  loc val`i': word `i' of `catvals'
> >}
> >
> >Then you can grab those val`i' for your equation names. If 
> you don't have 
> >fixed number of equations, then you need to again set up 
> some kind of 
> >loops. Not sure if this is what you meant to accomplish.
> 
> Incidentally, I am finding that this may be more trouble than it is 
> worth.  mlogit seems to be able to handle just about any 
> value label and 
> using it as the equation name.  But, I am finding that I have 
> trouble with 
> value labels that contain spaces or commas, and value labels 
> that get used 
> more than once, and probably various other quirks I haven't 
> tested yet. 
> Just leaving the equation names as eq1, eq2, etc. is starting 
> to look more attractive. 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index