Hi all,
I am trying to get a program working that would allow me to not rewrite an if else statement 100x to highlight values greater than 0.
However, I am getting the following error when I try to run my code:
:
100,8,2,17 invalid name
r(198);
The code is simply like:
I'm very new to writing, or trying to write, programs in STATA... so any pointers would be most appreciated.
Thanks!
I am trying to get a program working that would allow me to not rewrite an if else statement 100x to highlight values greater than 0.
However, I am getting the following error when I try to run my code:
:
100,8,2,17 invalid name
r(198);
The code is simply like:
Code:
local val = 100 local row = 8 local col = 2 local num = 17 capture program drop myhl program myhl, rclass args val row col num local perc = "%" if(`val' > 0) { putdocx table t`num'(`row',`col')=("`val'`perc'"), halign(right) shading(lime) } else { putdocx table t`num'(`row',`col')=("`val'`perc'"), halign(right) } local ++row return local row `row' end * and I am trying to call it with myhl(`val',`row',`col',`num')
I'm very new to writing, or trying to write, programs in STATA... so any pointers would be most appreciated.
Thanks!
Comment