I had a student run into a problem creating a graph when trying to apply a scheme...it wouldn't apply even though the scheme option was properly specified. I was able to solve the problem (there was a space after the over option before the parenthesis that contains the arguments and sub options) but was confused by Stata's behavior as I tried to find a solution. Here are some sample data that I'll use to reproduce the confusion in hopes that someone can give me some insight.
Code:
clear input y x1 x2 5 0 0 4 0 1 6 1 0 3 1 1 end
Code:
gr bar y, /// over (x1, gap(10)) /// over (x2, gap(50)) /// scheme(s1mono)
Array
If I remove the gap suboptions, the scheme is applied:
Code:
gr bar y, /// over (x1) /// over (x2) /// scheme(s1mono)
If I leave the gap sub options but move the scheme option to before the over options, the scheme is applied:
Code:
gr bar y, scheme(s1mono) /// over (x1, gap(10)) /// over (x2, gap(50))
If I remove the spaces after the over options, the scheme is applied:
Code:
gr bar y, /// over(x1, gap(10)) /// over(x2, gap(50)) /// scheme(s1mono)
It seems that the space after the over option is causing the problem but it's the space when the gap suboption is specified. Having the scheme appear before the option sidesteps the problem somehow. I'm puzzled. I'm either missing something about Stata syntax or this is a bug. If I'm missing something, I'd love to know what it is.
Thanks,
Lance
0 Response to Help understanding behavior of space in graph code
Post a Comment