Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: RE: RE: RE: Placing results in a new stata sheet


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: RE: RE: Placing results in a new stata sheet
Date   Tue, 1 Jun 2010 21:06:52 +0200

<>

"-statsby- is what has been called a reduction command. It replaces the present dataset"



-statsby- can be made to save its results with the -saving()- option, though, instead of forcing out the original data:


***
sysuse auto, clear
statsby _b, by(rep78) saving(myfile, replace) : reg pr we le
***


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Dienstag, 1. Juni 2010 20:12
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: RE: Placing results in a new stata sheet

Given the kind plug, it is a little ungracious to dissent slightly: 

The purposes of -postfile- and -statsby- differ enough for me to want to call them cousins rather than brothers (or sisters). 

-postfile- is for producing a separate dataset file. 

-statsby- is what has been called a reduction command. It replaces the present dataset with a reduced set of results, one observation for each group. 

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

Also note -statsby-, -postfile-`s smaller brother. Sometimes it is sufficient to get where you want. It is much simpler to use, but you lose the versatility of -postfile-. 
Re -statsby-, see NJC`s recent column at http://www.stata-journal.com/article.html?article=gr0045.

Martin Weiss

This cries out for the use of -postfile-, as in Michael`s http://www.michaelnormanmitchell.com/stow/posting-results-regression.html and two following posts, or check the archive, as in http://www.stata.com/statalist/archive/2009-10/msg01043.html. 

George Chioran

I want to store the
results that I obtain from several while loops. First I have the time variable “t”:
1, 2, 3, … and are in total 16. Then I have the accounts “a”: 210, 245, 256, … and
are in total 700. In time period 1 I get a different result for all 700
account. In time period 2 the same happens and so on. I would like to somehow
save the results that I get from each account under each period. 
My code goes like
this:
 
local t = 1
local a = 1
While `t’ <= 16 {
                        While `a’ <=
700 {
                                                    …..          
In this loop I get the results for a = 1 which is r1, for a = 2 which is
r2 and so on. Could I somehow save the results r1, r2,… in a new stata sheet?
                                                        local
a = `a’+1
                                                         }
                          local t = `t’ +1
                          }

I would like the
results to be placed in a table like this:
ta                            result
1              210                         r1
1              245                         r2
1              256                         r3
…             …                             …
2              210                         r1
2              245                         r2
2              256                         r3
…             …                             …
 
So when the loop with
variable t is at 1, the table should put in the first column only 1, in the
second column the current account and in the third column the result of the current account. 


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index