Hello Statalist community,
This is my Code:
I would appreciate your help with a couple of things:
1) Can I add a line of division to the following graph? (I want to add a vertical line to it at the 2018m8 point)
2) How do I add a Y axis label that says "CAD" and change X-axis labels to just the year without the m1..m12, using code?
3) Instead of the actual data I want to generate 4 lines of best fit on the same graph, is that possible?
This is my Code:
Code:
clear all cd "/Users/Yeshwin1/Desktop/fall 24/Econ 4550" use "lfs_2013.dta" append using "lfs_2014.dta" append using "lfs_2015.dta" append using "lfs_2016.dta" append using "lfs_2017.dta" append using "lfs_2018.dta" append using "lfs_2019.dta" append using "lfs_2020.dta" append using "lfs_2021.dta" append using "lfs_2022.dta" append using "lfs_2023.dta" keep if lfsstat==1 | lfsstat==2 keep if !missing(survyear, survmnth, sex, hrlyearn) keep if survyear==2013 & !missing(naics_18) |survyear==2014 & !missing(naics_18)| survyear==2015 & !missing(naics_18)| survyear==2016 & !missing(naics_18) | survyear==2017 & !missing(naics_21)|survyear==2018 & !missing(naics_21) | survyear==2019 & !missing(naics_21)| survyear==2020 & !missing(naics_21)| survyear==2021 & !missing(naics_21)| survyear==2022 & !missing(naics_21)| survyear==2023 & !missing(naics_21) gen date= ym(survyear, survmnth) format date %tm sort date drop if naics_18==1 | naics_18==2 | naics_18==3 | naics_18==10 | naics_18==13 | naics_18==14 | naics_18==15 | naics_18==16 |naics_21==1 | naics_21==4 | naics_21==12 | naics_21==16 | naics_21==17 | naics_21==18 | naics_21==19 | naics_21==5 egen wagePublic=mean(hrlyearn) if naics_18==9 |naics_18==18 |naics_21==11 | naics_21==21, by(sex date) egen wagePrivate=mean(hrlyearn) if naics_18!=9 | naics_18!=18 |naics_21!=11 | naics_21!=21, by(sex date) gen incomePublic = wagePublic*1 gen incomePrivate = wagePrivate*1 separate incomePublic, by(sex) separate incomePrivate, by(sex) line incomePublic1 incomePublic2 incomePrivate1 incomePrivate2 date, legend(subtitle("Average Hourly Wage") order(1 "Public Sector Male" 2 "Public SectorFemale" 3 "Private Sector Male" 4 "Private Sector Female"))
1) Can I add a line of division to the following graph? (I want to add a vertical line to it at the 2018m8 point)
2) How do I add a Y axis label that says "CAD" and change X-axis labels to just the year without the m1..m12, using code?
3) Instead of the actual data I want to generate 4 lines of best fit on the same graph, is that possible?
Comment