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]

st: Save -table- command results


From   Pablo Bonilla <[email protected]>
To   statalist <[email protected]>
Subject   st: Save -table- command results
Date   Mon, 12 Mar 2012 09:44:51 -0400

Dear statalist,

I would like to know if there is a way to save the results from the
-table- command in matrices. I am using the –statsmat- command but It
is very inefficient if I need to use it with the by() option.

For instance, this is what I want to save:
table decil [w = factor], c(sum var1  sum var2 sum var3  sum var4 sum
var5)  f(%19.2f) row

But I have to do it in this way in order to get a matrix:
cap mat drop mat1
foreach var in var1 var2 var3 var4 var5 {
	statsmat `var' [w = factor], by(decile) stat(sum) format(%16.0f)
matrix(`income')
	mat mat1 = nullmat(INCOME),`income'
}


Thank you so much.


----

Pablo Bonilla

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


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