Hello Stata community;
I dispose of this data:
My goal is to draw a 2 Y axish graph (my two Y variables are unemployment & employment) using the X variable date. The problem is that this date variable is in string format.
I've tried this code: graph twoway (scatter unemployment date, connect(direct) msymbol(circle) msize(large) mcolor(green) yaxis(1) ytitle("Unemployment", axis(1))) (scatter employment date, connect(direct) msymbol(diamond) msize(small) mcolor(black) yaxis(2) ytitle("Employment", axis(2))), but I guess it didn't work out because the date variable is in string format.
Should I change the date variable format? If so, how? Or, is there another way to get to my goal?
Thanks for your help.
I dispose of this data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str7 date float(unemployment employment) "Q1 2008" 5 71.50778 "Q2 2008" 5.3 71.25295 "Q3 2008" 6 70.73177 "Q4 2008" 6.9 69.96442 "Q1 2009" 8.3 68.65476 "Q2 2009" 9.3 67.8991 "Q3 2009" 9.6 67.302895 "Q4 2009" 9.9 66.5618 "Q1 2010" 9.8 66.73094 "Q2 2010" 9.6 66.79226 "Q3 2010" 9.5 66.724525 "Q4 2010" 9.5 66.44049 "Q1 2011" 9 66.655556 "Q2 2011" 9.1 66.49724 "Q3 2011" 9 66.58442 "Q4 2011" 8.6 66.779106 "Q1 2012" 8.3 66.96114 end
I've tried this code: graph twoway (scatter unemployment date, connect(direct) msymbol(circle) msize(large) mcolor(green) yaxis(1) ytitle("Unemployment", axis(1))) (scatter employment date, connect(direct) msymbol(diamond) msize(small) mcolor(black) yaxis(2) ytitle("Employment", axis(2))), but I guess it didn't work out because the date variable is in string format.
Should I change the date variable format? If so, how? Or, is there another way to get to my goal?
Thanks for your help.

Comment