|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Output tables, tabulations, etc to a text file
Austin,
Thanks for this. If you wouldn't mind with some clarification: It seems
to me that creating new datasets as the desired tables and then
appending the datasets into one dataset to be outsheeted is an enormous
work-around. Can't I simply output to a file the results of a -tabulate-
and put the results on the end of a progressively growing file as I loop
through the US states?
Is your method the standard way to output complex tables from Stata?
What is the best method for outputting a complex table from Stata as a
comma or tab delimited file?
Below are questions on your proposed method:
Jeff Pflueger <[email protected]>:
You may want a loop that -use-s each dataset in turn,
Exactly. I am already doing that in the do file.
-collapse-s to a
"tab" dataset,
I am indeed collapsing to accomplish something else with each
dataset.....but what is collapsing to a "tab" dataset? So rather than
using a command like -tabulate- to create results, I could accomplish
this from within a -collapse- command and actually create a new dataset?
What does the syntax look like for something like this?
then -append-s to put all the "tabs" together in one
dataset,
That makes sense if I were working with newly created datasets as
opposed to standard Stata output.
then perhaps -outsheet- to write a tab-delimited file. This
is also possible with -file- but more work to write. Hard to say what
is optimal for you given only the info below.
On Wed, Jul 9, 2008 at 7:47 PM, Jeff Pflueger <[email protected]> wrote:
I have a do file that goes through a dataset for each US state.
From each state I need a few pieces of information by county. Most of this I
can do for each state through tabulate:
tabulate county interesting_yes_no_question [fw=weight]
I'd like to take the results of the tabulation and append them to a results
file that is comma or tab delimited so that by the time the do file has gone
through all the state datasets, I have a single comma or tab delimited file
of the results for all of the states.
There seems to be about half a dozen approaches to getting Stata output into
a file. None seem too clean at this point. Nothing I've seen is too elegant
yet.
Isn't there an easy way that I can take the results from a command like
tabulate and then use "file" to append them to the end of a file?
Thanks for any help!
Jeff
*
* 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/
*
* 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/