Hi there
I am trying to set up a time series line graph to illustrate the growth rate of two variables. I have generated two new variables to show the yearly growth rate, then added these to a two way line graph. Please see code below
gen L_Prod = L.Avg_Prod
gen GR_Prod = 100*(Avg_Prod-L_Prod)/L_Prod
gen L_Import_Total = L.Import_Total
gen GR_Import = 100*(Import_Total-L_Import_Total)/L_Import_Total
label var GR_Import "Import value growth rate (%)"
label var GR_Prod "Productivity growth rate (%)"
twoway tsline GR_Prod, yaxis(1) || tsline GR_Import, yaxis(2)
The x axis is year but I want to change the range. I have tried to use xlabel but it doesn't recognise any years I put in. Eg I tried xlabel (2016 2017 ...) and also xlabel (2016(1)2021).
Each time I had an error message saying 2016 is an invalid name. Perhaps this is because I'm working with panel data as apposed to time series data? Is there any way around this?
Screenshot of graph is attached for reference.
Thanks in advance
I am trying to set up a time series line graph to illustrate the growth rate of two variables. I have generated two new variables to show the yearly growth rate, then added these to a two way line graph. Please see code below
gen L_Prod = L.Avg_Prod
gen GR_Prod = 100*(Avg_Prod-L_Prod)/L_Prod
gen L_Import_Total = L.Import_Total
gen GR_Import = 100*(Import_Total-L_Import_Total)/L_Import_Total
label var GR_Import "Import value growth rate (%)"
label var GR_Prod "Productivity growth rate (%)"
twoway tsline GR_Prod, yaxis(1) || tsline GR_Import, yaxis(2)
The x axis is year but I want to change the range. I have tried to use xlabel but it doesn't recognise any years I put in. Eg I tried xlabel (2016 2017 ...) and also xlabel (2016(1)2021).
Each time I had an error message saying 2016 is an invalid name. Perhaps this is because I'm working with panel data as apposed to time series data? Is there any way around this?
Screenshot of graph is attached for reference.

Comment