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

Re: st: export and use of queried data table

From   Steven Samuels <>
Subject   Re: st: export and use of queried data table
Date   Tue, 14 Oct 2008 23:07:35 -0400

Todd, Joseph has mentioned commands which allow you to save and re- use data and to save summaries of tabulations as data. You also need to learn some other basic commands, such as the "log using" command, which will create a log file and save to it all results you see in the viewer. If you are not sure of how to do something (say "XXX") in Stata, type "search XXX" or "search XXX, all". For example, "search saving" or "search save" will get Stata help entries on your computer for saving data (and other things); "search saving, all" will get internet resources as well.

Here are some good online resources for learning Stata. statatutorial //references a tutorial for SAS users

Be sure to read the Staalist FAQ, especially Section 3.


On Oct 14, 2008, at 10:06 PM, Joseph Coveney wrote:

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

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

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:

*   For searches and help try:

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