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
I know that for a single mean variable the code would be:
however I am confused as to how to combine 2 mean variables into 1
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)
Code:
egen meanwage= mean (employeewage), by (job)
Comment