# Re: st: RE: RE: Making a Matrix from Three Variables

 From Tirthankar Chakravarty To statalist@hsphsun2.harvard.edu Subject Re: st: RE: RE: Making a Matrix from Three Variables Date Mon, 11 May 2009 00:36:15 +0100

There don't have to be missing values in var3. As long as your rows
and columns variables don't take you everywhere in the matrix, i.e.
you don't have all possible tuples A={(i,j) | i=1,..., maxrows;
j=1,..., maxcols} you will be left with missing values.

T

On Mon, May 11, 2009 at 12:17 AM, Allan Joseph Medwick
<amedwick@gmail.com> wrote:
> This works very well, but I ran into the 1,200 row x 80 column
> limitation in "tab".  It would be great if this feature was added to
> "table", which does not have the same limitation.
>
> I am still trying out the more elaborate solutions.  There were no
> missing values in var3, but there were missing values in my matrix, so
> I am trying to figure out what went wrong.
>
> Thanks!
> Allan
>
> On Sun, May 10, 2009 at 11:09 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
>> Sorry, I should have mentioned that you need to scale the matrix:
>>
>> . su z
>>
>>    Variable |       Obs        Mean    Std. Dev.       Min        Max
>> -------------+--------------------------------------------------------
>>           z |         9    .4411562    .2579396   .0610638    .684176
>>
>> . mat matrix = matrix * r(mean)
>>
>> Nick
>> n.j.cox@durham.ac.uk
>>
>> Nick Cox
>> There have been several elaborate solutions to this, but a very simple one may be enough -- using an official command only.
>>
>> I gather that each row and column combination (var1, var2) occurs once only.
>>
>> That being so, note that
>>
>> tab var1 var2 [aw=var3], matcell(matrix)
>>
>> yields a matrix. But see help on -limits-.
>>
>> Allan Joseph Medwick
>>
>> I have three variables (var1, var2, var3).  I would like to create a
>> matrix where the values of var1 are the columns (ascending), the
>> values of var2 are the rows (also ascending), and the values of var3
>> are the elements in the matrix.  I know there must be a user defined
>> procedure out there to do this, but I haven't been able to find it.
>>
>>
>> *
>> *   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/
>>
>
>
>
> --
> Allan Joseph Medwick
> Telephone: 267.872.0336
>
> *
> *   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/
>

--
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   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/