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 two-way tables as a dataset
From
Hewan Belay <[email protected]>
To
Stata List <[email protected]>
Subject
st: save two-way tables as a dataset
Date
Thu, 3 Jun 2010 08:17:03 -0700 (PDT)
Dear Statalist,
Back in 2009 there was a thread about how to save stata outputs, such as outputs from the -table- command, as datasets:
http://www.stata.com/statalist/archive/2009-04/msg00321.html .
This seems to work well only in one-way tables. For example, using the example Martin gave back then, the following works well:
sysuse auto, clear
table rep78, contents(sum headroom ) row
table rep78, contents(sum headroom ) row replace
list
However, I want to save a twoway table as a dataset. Notice that the datset doesn't look much like the output table:
table rep78 foreign, contents(sum headroom ) row
table rep78 foreign, contents(sum headroom ) row replace
list
I want it to look more or less like the output table, that is, in this case a dataset with three variables--rep78, domestic, and foreign--for example so that I can create, say, an additional variable which gives me the ratio of domestic to foreign etc. Sure, I can do -reshape- and so forth, but it would be much cleaner if the output could be produced as a dataset without me having to write several lines to get it to look like the output.
Thanks for any help on this,
Hewan
*
* 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/