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]

Re: st: save table output to a matrix


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: save table output to a matrix
Date   Thu, 4 Apr 2013 00:55:00 +0100

Indeed, you said that and I missed it. My excuse is that you didn't
spell that out as requested (-plotmatrix- (SSC)).

You might be able to figure this out from -makematrix- (SJ) but it
could be easier just to write your own loops:

sysuse auto, clear

matrix means = J(5,2,.)

forval i = 1/5 {
forval j = 0/1 {
su mpg if foreign == `j' & rep78 == `i', meanonly
matrix means[`i', `j' + 1] = r(mean)
}
}

On 4 April 2013 00:37, Dimitriy V. Masterov <[email protected]> wrote:
> Nick,
>
> That's exactly what I am doing. I am just having trouble getting the
> mean of z for each of the x*y groups into a matrix form that
> plotmatrix can use.
>
> DVM
>
> On Wed, Apr 3, 2013 at 4:23 PM, Nick Cox <[email protected]> wrote:
>> Have a look at -plotmatrix- (SSC, Adrian Mander).
>>
>> (I'd rather represent values by bar lengths than colour shades, which
>> could use -tabplot- (SSC).)
>>
>> Nick
>> [email protected]
>>
>> On 4 April 2013 00:15, Dimitriy V. Masterov <[email protected]> wrote:
>>> Is it possible to save the output of table command to a matrix? I
>>> would like to stick the output of  -table x y, c(mean z)- into a
>>> matrix so that I can use plotmatrix on it.
>>>
>>> The end goal is to produce plots like the average wage ones from
>>>
>>> http://www.adeptanalytics.org/radyakin/stata/graphics/radyakin_graphics.htm
>>>
>>> If there's a better way to do that, please let me know.
>> *
>> *   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/



-- 
Nick
[email protected]
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index