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]
Re: st: One varlist into a matrix with multiple columns
From
Sergiy Radyakin <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: One varlist into a matrix with multiple columns
Date
Wed, 14 Aug 2013 16:38:24 -0400
No. In general it is not possible.
There is not enough information regarding the size of the resulting matrix.
Based on your description, the dataset could be like (just one observation):
1 1 9
But the resulting matrix could be
9
9,.\.,.
9,.,.\.,.,.\.,.,.
or 9,.,.,.,.,.,.,.,.,.,.,.
or anything else.
However if the dimensions of the matrix are known, that is very
trivially doable with a forval loop.
Best, Sergiy
On Wed, Aug 14, 2013 at 4:15 PM, Samuel Bailey <[email protected]> wrote:
> Hello,
>
> I have a dataset with three columns: the first two are the i and j
> coordinates of a potential matrix, and the third is the data that
> would go into the (i,j)th spot. Is there a way (in Stata or Mata) to
> create a matrix directly from these three variables? I've tried using
> -mkmat- to create a column vector which gets sent to Mata, where it's
> looped through into a new matrix. However, as a column vector the data
> exceeds the maximum matrix size in my version of Stata (though as a
> square matrix it would not).
>
> Sincerely,
> Sam Bailey
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/