Hi bros,
I'm sorry if my question feels obvious for you but i need an answer.
Basically, i need to compute the vertical distance between 2 lines of a twoway graph for each of my obs of one of the two lines (the red line).
I give you a the command to reproduce the graph and data. I also attached the graph but it's my first message here so i still don't know if it will work.
In the graph that i attached, i putted (with paint...) some vertical black lines who starts from one obs of the red line the the blue line (and not to an obs of the blue line), that's what i need to compute for each obs of the red line (year=2000).
***************************
clear all
set obs 40
gen year=_n
replace year=1000 if year>20
replace year=2000 if year<21
bysort year : gen age= _n + 49
gen mortality=((age^5/age)/year^3)*100
replace mortality= (1+mortality)^2 if year==2000
gen employement=(((age^4)/(age^7))*100000)-((year^2)/40000000)
replace year=1950 if year==1000
twoway connected employement mortality if year==1950 ///
|| connected employement mortality if year==2000
************************
As you can see, the mortality rates never matches between the 2 different years so...
I cannot make a simple difference between the two employement of the two different years for the same mortality rates (because mortality rates never matches)
Hope it was clear and that you will give me an easy solution for this.
Thank you.
PP.
I'm sorry if my question feels obvious for you but i need an answer.
Basically, i need to compute the vertical distance between 2 lines of a twoway graph for each of my obs of one of the two lines (the red line).
I give you a the command to reproduce the graph and data. I also attached the graph but it's my first message here so i still don't know if it will work.
In the graph that i attached, i putted (with paint...) some vertical black lines who starts from one obs of the red line the the blue line (and not to an obs of the blue line), that's what i need to compute for each obs of the red line (year=2000).
***************************
clear all
set obs 40
gen year=_n
replace year=1000 if year>20
replace year=2000 if year<21
bysort year : gen age= _n + 49
gen mortality=((age^5/age)/year^3)*100
replace mortality= (1+mortality)^2 if year==2000
gen employement=(((age^4)/(age^7))*100000)-((year^2)/40000000)
replace year=1950 if year==1000
twoway connected employement mortality if year==1950 ///
|| connected employement mortality if year==2000
************************
As you can see, the mortality rates never matches between the 2 different years so...
I cannot make a simple difference between the two employement of the two different years for the same mortality rates (because mortality rates never matches)
Hope it was clear and that you will give me an easy solution for this.
Thank you.
PP.
Comment