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: AW: AW: save two-way tables as a dataset


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: AW: save two-way tables as a dataset
Date   Thu, 3 Jun 2010 17:45:17 +0200

<> 

BTW, the output from -table- still allows you to calculate a ratio where
appropriate:


*************
sysuse auto, clear
table rep78 foreign, contents(sum headroom ) row replace
list, sepby(rep78) noo
bys rep78 (foreign): gen ratio=table1[1]/table1[2] if _N==2
list, sepby(rep78) noo
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Donnerstag, 3. Juni 2010 17:36
An: [email protected]
Betreff: st: AW: save two-way tables as a dataset


<> 


Where and how do you want to use/further process the results? 

You may want to look at Ian`s -ssc d tabout- (the ssc server may be down at
the moment, just as Kit said last night). 



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Hewan Belay
Gesendet: Donnerstag, 3. Juni 2010 17:17
An: Stata List
Betreff: st: save two-way tables as a dataset

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/


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


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