Am Donnerstag, den 03.09.2009, 22:35 -0400 schrieb Nirina F:
> Hello,
> I have the following variables : wage and year of birth
>
> I would like to graph the mean(wage) on y axis and year of birth on x axis.
>
> Should I sort the wage by year of birth to calculate the mean of wage and then
> scatter meanofwage yearofbirth
. egen meanwage = mean(wage), by(yearofbirth)
. scatter meanwage yearofbirth
is one possibility. The advantage of this solution is that it keeps your
data as it is. The disadvantage is that the file size of the graph
becomes arbitrary large if you have many observations.
A solution that destroys the data in memory but produces smaller graphs
(in terms of bandwidth) is
. collapse (mean) wage, by(yearofbirth)
. scatter wage yearofbirth
Many regards
Uli
*
* 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/