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
generate variable on the basis of industry year and firmDear Forum, I have the following very basic problem. Unfortunately, I couldn't find an appropriate s…
Undisplayed dates: weekends, public holidays, and other reasonsHi I have a dataset that includes daily observations and a daily date variable (DATE). Some dates a…
"variable at_exp_share11 already defined" is always displayed when I run the command."variable at_exp_share11 already defined" is always displayed when I run the command. But I can conf…
Compute Estimated Hazard and Plot Estimated Hazard Curve after Fitting a xtmelogit Survival Model in StataThe dataset is presented below, insheet using "https://ift.tt/aXA9elG", comma foreach i of varlist …
Number of Estimated Coefficients in a RegressionIs there a way to display the number coefficients estimated in a regression? I am estimating differe…
Subscribe to:
Post Comments (Atom)
0 Response to graph add vertical line using value in macro variable
Post a Comment