Statalist


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

st: Teach an old dog new tricks


From   "Sergiy Radyakin" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Teach an old dog new tricks
Date   Thu, 8 May 2008 10:16:38 -0400

Hello Statalisters,

I am looking for a way to get the matrix of means, which is displayed
but not saved by, e.g.:

sysuse auto
table rep78 head, c(mean price)

The (relatively new) svy commands allow this, but they are quite slow
for the purpose. -table- was in Stata for ages, but it still does not
save any matrix results.

I am aware of an option replace, which saves the means in the dataset,
but it destroys the data, - something I am trying to avoid. Adding
preserve/restore will slow the program down sufficiently enough to
reject this way of doing it.

Is it possible to obtain a matrix of means from table (or another
command with a similar functionality) (preferred) ? Or is it possible
to tell table,replace to keep the existing data and add the computed
statistics as new variables (good)?

Note that tabstat does not allow what I am looking, since it only
supports one var in the by() clause, and I will need to call it N
times (where N is the number of categories in the second var) and
combine the columns together, which is not fast either.

Also note, that while

   tabulate rep78 foreign, matcell(A)

is a valid syntax,

  tabulate rep78 foreign, matcell(A) summarize(price) mean

which presumably could be the solution I am looking for, is not valid:
  r(198); option matcell() not allowed

Any suggestions are welcomed.

Thank you,
  Sergiy Radyakin
*
*   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