Thank you for your advice Nick, but somehow your suggestion is not reproducible. Here's what happened when I followed your example:
. sysuse auto
(1978 Automobile Data)
. tabstat mpg rep78, save
stats | mpg rep78
---------+--------------------
mean | 21.2973 3.405797
------------------------------
. return list
matrices:
r(StatTot) : 1 x 2
. mat total = r(StatTotal)
. mat li total
symmetric total[1,1]
c1
r1 .
And that's that. Wonder whether others with Stata 8.2 would be able to reproduce this error? Or is it me specific? Appreciate further advice.
Regards,
bw
----------------------------------------
> Subject: st: RE: tabstat: how to access saved r(values)
> Date: Tue, 9 May 2006 17:47:07 +0100
> From: [email protected]
> To: [email protected]
>
> 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/
_________________________________________________________________
Join the next generation of Hotmail and you could win the adventure of a lifetime
http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx
*
* 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/