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

AW: st: Saving results

From   "Martin Weiss" <>
To   <>
Subject   AW: st: Saving results
Date   Sat, 10 Oct 2009 17:36:19 +0200


You do not even have to specify the r-class result, as -statsby- defaults to it. 

- statsby, by(marst ed) clear: fastgini wage-

John correctly noted that -fastgini- does not allow -by-, but -statsby- is still useful here. It also allows him to omit any explicit looping and thus to keep his code tidy...


-----Ursprüngliche Nachricht-----
Von: [] Im Auftrag von Maarten buis
Gesendet: Samstag, 10. Oktober 2009 17:02
Betreff: Re: st: Saving results

--- On Sat, 10/10/09, John Pfaff wrote:
> I have a question about saving individual results while
> running a loop. I'm trying to compute the annual state-level
> gini coefficient across several states and years, using
> fastgini. <snip>
> What I want to produce is a file that has a column for
> state, a column for year, and a column for the gini output.

-fastgini- is a user written program, and the statalist FAQ
askes you to report where you got it from (there are often
multiple version of user written software floating around
in cyberspace, and it would be a waste of time if we weren't
talking about the same program...) I am assuming you downloaded
it from SSC. You can use -statsby- for this problem:

*----------------- begin example ---------------
sysuse nlsw88, clear
gen marst = cond(never_married==1,1, ///
            cond(married==1, 2, 3))  ///
            if !missing(married, never_married)
gen ed = cond(grade < 12, 1, ///
         cond(grad==12,2, 3)) ///
         if grade < .

statsby gini= r(gini), by(marst ed) clear: fastgini wage
*---------------------- end example --------------------------

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

Send instant messages to your online friends 

*   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