Statalist


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

Re: st: export and use of queried data table


From   "Joseph Coveney" <[email protected]>
To   "Statalist" <[email protected]>
Subject   Re: st: export and use of queried data table
Date   Wed, 15 Oct 2008 11:06:47 +0900

Todd A Rinaldi wrote:

New to STATA  (Intercooled 9) and I am working with a huge ecological
dataset. My question for the community is where do I find the results
table from a query . For instance I ran the following command:
by animal_id month, sort: tabulate on_trails and I would like to
generate graphs and continue to work with these data set. Is this a read
only data set? Am I only able to view results in the viewer and export
to textpad or word? I thought this would a basic command common to all
stats packages?

--------------------------------------------------------------------------------

Stata keeps the active dataset in memory, and doesn't overwrite it with most
commands for calculating summary statistics, including -tabulate-.  You
won't overwrite your dataset by performing a tabulation with -tabulate-.

If you want to create a new dataset containing the tabulations (overwriting
the original dataset in memory), then use -contract-, -collapse- or similar
command.

That is,

contract animal_id month on_trails

will give you a new dataset with the cell counts in a new variable named
_freq by default.  (You can specify a name as an option--see the
documentation.)

collapse (count) on_trails, by(animal_id month)

will do similarly for nonmissing values of on_trails.

You may then save the new dataset (be careful to specify a new file name for
the new dataset, i.e., -save monthly_trail_tabulation- and not -save,
replace-).  You may also graph and work-up the new dataset as you like.

Joseph Coveney


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index