Thanks everyone--your advice helped perfectly.
>>> "Martin Weiss" <[email protected]> 10/10/09 11:40 AM >>>
<>
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...
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Maarten
buis
Gesendet: Samstag, 10. Oktober 2009 17:02
An: [email protected]
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
list
*---------------------- end example --------------------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
Send instant messages to your online friends
http://uk.messenger.yahoo.com
*
* 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/
*
* 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/