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

RE: Re: st: making sure on the graph

From   Maarten buis <[email protected]>
To   stata list <[email protected]>
Subject   RE: Re: st: making sure on the graph
Date   Fri, 4 Sep 2009 13:44:09 +0000 (GMT)

--- Maarten buis wrote:
> > An intermediate solution that will get the small graph 
> > while keeping the data intact is:
> >
> > . bys yearofbirth (wage): gen byte first = _n == 1
> > . egen meanwage = mean(wage), by(yearofbirth)
> > . scatter meanwage yearofbirth if first

--- Nick Cox wrote:
> Maarten's solution is good, but there is no need for the
> sorting within -yearofbirth-

This is correct. My solution came directly from my default 
library of tricks. In a general case this will make sure 
that first will tag an observation that has a valid 
(non-missing) value on whatever I am sorting on, in this 
case wage, unless all values of wage are missing within a 
category of yearofbirth. This is not relevant in this 
case as meanwage will always contain valid values. 

-- Maarten

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


*   For searches and help try:

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