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

Re: st: Saving results

From   Maarten buis <>
Subject   Re: st: Saving results
Date   Sat, 10 Oct 2009 15:01:59 +0000 (GMT)

--- 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:

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