Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65052

Generating a new variable as the mean of multiple variables

$
0
0
Hi,

I want to create a new variable called mean wage which is going to measure the average wage by job. I have 2 wage variables in my data. One for the employees and one for the self-employed. I have been trying different combinations of the egen command like the below however they are obviously wrong and I am not sure how to correct them or if I shall be using a different command after all
Code:
egen meanwage= mean (employeewage)if employmentstatus==3 & mean (selfemployedwage)if employmnetstatus<3, by (job)
I know that for a single mean variable the code would be:
Code:
egen meanwage= mean (employeewage), by (job)
however I am confused as to how to combine 2 mean variables into 1

Viewing all articles
Browse latest Browse all 65052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>