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
need urgent helpI tried to do heteroskedasticity test for panel-level data by using the commands from the site menti…
Promotion ProblemsThe summary of this post is that (a) replace, nopromote functions differently on string variables th…
Simulating data for logistic regression with categorical variablesDear Statalists, I would like to test the effect of sample size on standard errors of interaction e…
rounding to 0.5, 1.5, 2.5, 3.5 etcHello, I have a question in regard to rounding. As an example I have a data like this: Code: list …
Generated regressor problem and bootstrapping?Hello, I have the fitted values of a regression to be used as a regressor for another set of regres…
Subscribe to:
Post Comments (Atom)
0 Response to graph add vertical line using value in macro variable
Post a Comment