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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: Re: st: no room to add more double literals |

Date |
Tue, 18 Jan 2011 16:02:30 +0000 |

In response to > 1) if I try to input a matrix with 1,1,1,1\2,2,2,2\3,3,3,3.... it hits > the limit as well with a different error > message, but still pretty soon to be practical. I may be wrenching this out of context, but I note that there is no obvious need to spell out every value of a matrix with such simple structure. Consider : J(1,4,(1..20)') 1 2 3 4 +---------------------+ 1 | 1 1 1 1 | 2 | 2 2 2 2 | 3 | 3 3 3 3 | 4 | 4 4 4 4 | 5 | 5 5 5 5 | 6 | 6 6 6 6 | 7 | 7 7 7 7 | 8 | 8 8 8 8 | 9 | 9 9 9 9 | 10 | 10 10 10 10 | 11 | 11 11 11 11 | 12 | 12 12 12 12 | 13 | 13 13 13 13 | 14 | 14 14 14 14 | 15 | 15 15 15 15 | 16 | 16 16 16 16 | 17 | 17 17 17 17 | 18 | 18 18 18 18 | 19 | 19 19 19 19 | 20 | 20 20 20 20 | +---------------------+ which can be generalised for "any value of 20" (or 4 for that matter). On the other hand, this behaviour of J() was not in the very first release of Mata SJ-8-3 pr0043 . . . . . Stata tip 67: J() now has greater replicating powers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q3/08 SJ 8(3):450--451 (no commands) tip detailing Mata J() function recent enhancements and so may not be old-fashioned enough for Sergiy. But there are other ways to do it. Even the pedestrian (1..20)',(1..20)',(1..20)',(1..20)' looks a better solution to me. What am I missing? Nick On Tue, Jan 18, 2011 at 3:44 PM, Sergiy Radyakin <serjradyakin@gmail.com> wrote: > Hello Kit, > > On Tue, Jan 18, 2011 at 9:23 AM, Christopher Baum <kit.baum@bc.edu> wrote: >> <> >> On Jan 18, 2011, at 2:33 AM, Sergiy wrote: >> >>> What is the best way to define, e.g. 100000x1 matrix in the Mata code? >>> (Another software is writing the Mata program, so I am not concerned >>> about the amount of labor). >> >> Why not just define the matrix (or the vec() of the matrix) as a Stata variable and view it in Mata? > > > Because it goes against the encapsulation paradigm ("a language > mechanism for restricting access > to some of the object's components" -- Wikipedia). > > My two other observations are: > 1) if I try to input a matrix with 1,1,1,1\2,2,2,2\3,3,3,3.... it hits > the limit as well with a different error > message, but still pretty soon to be practical. > > 2) if I run the original commands without wrapping them into a > function - everything works well > (presumably because the literals are not stored, but rather executed > right away). > > > I have found by now the response of David Drukker from 2007 regarding > the problem: > http://www.stata.com/statalist/archive/2007-08/msg00149.html > Since I need the program to be compatible with Stata 9, further > updates will not be applicable. > > Thank you, Sergiy * * 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/

**Follow-Ups**:**Re: Re: st: no room to add more double literals***From:*Sergiy Radyakin <serjradyakin@gmail.com>

**References**:**Re: Re: st: no room to add more double literals***From:*Christopher Baum <kit.baum@bc.edu>

**Re: Re: st: no room to add more double literals***From:*Sergiy Radyakin <serjradyakin@gmail.com>

- Prev by Date:
**st: RE: generalized Dunnett's test?** - Next by Date:
**Re: st: Keep observations in panel data** - Previous by thread:
**Re: Re: st: no room to add more double literals** - Next by thread:
**Re: Re: st: no room to add more double literals** - Index(es):