Hi! I have panel data of mortality rate over time by state of the US as well as a dummy variable for an event that occurred in different states at different times. I was hoping to create line graphs for each state of this rate over time with vertical lines that indicate the event.
so far I have the following code:
twoway line (bipoc_rate year, by(state)), xline(2014, lcolor(red)) ytitle( Opioid Death per 100 000) title(year)
I would like the vertical line to occur when my variable mml equals 1.
Alternatively I could do:
twoway line bipoc_rate year if state==1, xline(2014, lcolor(red)) ytitle(Opioid Induced Death per 100 000) xtitle(Year)
But this would require me individually putting in the state and year that the event occurred.
Please let me know if this is possible or any advice, I am new to stata so anything helps.
Related Posts with twoway line graph with vertical lines that are conditional on third variable value
Merge m:1 using participant ID in matched case-control data - error messagesHi, I have a matched case control dataset with 3 controls to every case. I have data that I want to…
Stata16 MG, PMG estimationsPlease, any help for Stata16 commands for MG, PMG estimations? Thank you …
Help in 'moving common' commandI have an unbalanced panel, say firms over years, each firm has a variable of interest. I would like…
Replace values from bottom to topDear Statalists, I have a dataset in the following shape for several counties and years: County Ye…
Stata dates - combining data from two variables to create a Stata date variableHi All I have a variable date2 which holds information on month and year of medical examination: t…
Subscribe to:
Post Comments (Atom)
0 Response to twoway line graph with vertical lines that are conditional on third variable value
Post a Comment