# st: mean workplace years of education: based on percentage of the workforce in each of k occupations

 From Maarten buis To Renuka Metcalfe Subject st: mean workplace years of education: based on percentage of the workforce in each of k occupations Date Sun, 21 May 2006 21:08:02 +0100 (BST)

```I am sending this reply also to the statalist, since if you
found my answer puzeling, than chances are others on the list
found that too.

Let me build an example to see if I understand your
question: You have:
- a number of workspaces (say A, B, C, and D),
- a number of occupations (say white collar, and blue collar),
- individuals who have occupations within workspaces.

You want the mean years of education in each workspace.
So you take all people in workspace A and compute the
mean years of education, the same for workspace B, and so
on. So if the individual years of education is stored in
the variable ed, and the variable workplace tells you which
individual works in which workspace, than you could do that
by:

by workspace: egen meaned = mean(ed)

or equivalently:

egen meaned = mean(ed), by(workspace)

You also have the average years of education for white collar
occupations and blue collar occupations, and you have the
percentage of white in blue collar occupations in each
workplace. You want to compute the mean for each workplace by
multiplying the two. This basicly assumes that blue collar
workers are the same across workplaces. This does not seem like
a plausible assumption, especially if your occupational categories
are not very fine grained, and you have educational levels for
individual employees.

--- Renuka Metcalfe <rm18203@yahoo.co.uk> wrote:
> Is the command for
> Ej = Mean workplace years of education: based on
> percentage of the workforce in each of k occupations
> times average years of education for that occupation
> from worker respondents
>
> . egen meanedwk = mean(yearseducation), by (serno)
>
> and
>
> E2j = Mean workplace years of education: based on mean
> of eij across workplace
>
> .by workplace: egen mean yearseducation = mean
> (yearseducation)
>
> When I am using these 2 variables, will stat know they
> are different variables. How precisely are the above 2
> commands different.

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z214

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

Send instant messages to your online friends http://uk.messenger.yahoo.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```