Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Output tables, tabulations, etc to a text file


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Output tables, tabulations, etc to a text file
Date   Thu, 10 Jul 2008 09:49:45 -0400

Jeff Pflueger <jeff@infouse.com>:
You may want a loop that -use-s each dataset in turn, -collapse-s to a
"tab" dataset, then -append-s to put all the "tabs" together in one
dataset, 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 <jeff@infouse.com> 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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index