Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: tabstat: how to access saved r(values)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: tabstat: how to access saved r(values)
Date   Tue, 9 May 2006 17:47:07 +0100

I have difficulty knowing what the difficulty is
here, as you are quoting all that you need to
know. However, this may help: 

. sysuse auto, clear 
(1978 Automobile Data)

. tabstat mpg rep78, save 

   stats |       mpg     rep78
---------+--------------------
    mean |   21.2973  3.405797
------------------------------

. ret li

matrices:
         r(StatTotal) :  1 x 2

. mat total = r(StatTotal) 

. mat li total

total[1,2]
            mpg      rep78
mean  21.297297  3.4057971

. di total[1,1] 
21.297297

. di total[1,2]
3.4057971

In addition, some have found that -tabstatmat-
from SSC is helpful in following up -tabstat-. 

Nick 
[email protected] 

b. water
 
> Stata 8.2,
> 
> I did:
> 
> . tabstat incidn popsize, stats (sum) save
> 
>    stats |      incidn  popsize
> ---------+--------------------
>      sum |        83      3188
> ------------------------------
> 
> . return list
> 
> matrices:
>            r(StatTot) :  1 x 2
> 
> I want to access r(whatever x) that holds 83,  r(whatever y) 
> that holds 3188, and r(whatever z) that holds the statistics 
> (which in this case was a sum of)  if possible. Reason I ask, 
> so that I can utilize the values in a -do- file. Looking at 
> the manual [R] S-Z p. 195 this seems to be tantalizingly 
> possible but I don't know how to achieve it. Help's appreciated.
> 

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