I am using Stata 13
I want to develop code to add a single vertical line on a graph using a value obtained from a dataset rather than having to hard code the position of the line. This would make the code general.
I thought I would do it by saving a value from the data set in a macro variable and use the macro variable to substitute into the xline graph option.
The code below fails to add a line when I use the macro variable.
Is there something else I should be doing to get this to work?
clear
set obs 12
gen y = 42
gen time = _n/y*100
line y time, xline(7)
global time1 7
macro list
line y time, xline(`time1')
Thanks,
Kim
Related Posts with graph add vertical line using value in macro variable
Cox model with an unbalanced panelHello everyone, I'm running a cox model with an unbalanced panel from 2015-2021 to measure the fact…
Matching data over time?Hello, I have a sample from the Current Population Survey (CPS). My data is monthly from 2015-prese…
Creating new variable (subtracting) same individualHi, I am using individual-level dataset across 4 years to try and calculate the mobility out of low…
Reference period in new DID estimatorsHello all! I am running a few checks using the new heterogeneity-robust diff-in-diff estimators, spe…
vlookup generates same idI read the thread on Complicated Vlookup-type problem in a large dataset. I am facing a similar pro…
Subscribe to:
Post Comments (Atom)
0 Response to graph add vertical line using value in macro variable
Post a Comment