Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Christopher Baum <kit.baum@bc.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
re: st: Store results from table command in matrix |

Date |
Tue, 22 Nov 2011 10:52:22 -0500 |

<> Barbro asks Is there something similar to tabstatmat or makematrix for the table command? I would like to use the results from a "table" command as a matrix. -- example command .table var1 var2 , c(mean var3) concise does a simple solution to this problem exist? Please help - I do seem to have problems in phrasing the question in a way that doesn't produce a huge number of irrelevant results No. As you can see from --return list--, the --table-- command does not save anything beyond the sample size. Ian Watson's --tabout-- from SSC can be used to do this in a somewhat roundabout manner. sysuse auto tabout mpg rep78 using junk.csv, c(mean price) sum replace f(1) insheet using junk.csv,clear destring v*, force replace This will create numeric variables. If you want them as a Stata matrix (why?) you can use mkmat. Note that values not appearing in the two-way table show up as missings, so you might want to mvencode them as zeros (or not). Kit Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html * * 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/

**Follow-Ups**:**Re: st: Store results from table command in matrix***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**RE: st: psmatch2 with exact matching** - Next by Date:
**st: Updating the value of a specific cll of a matrix using the value of a variable** - Previous by thread:
**st: Store results from table command in matrix** - Next by thread:
**Re: st: Store results from table command in matrix** - Index(es):