Hi all,
When I was coding something custom using -program define-, I encountered some behavior I didn't expect. When an option that begins with "no" is fed into a program, it seems to be treated as a logical value rather than, say, a string. Interestingly, you can't begin a string with "N" or just use "no" by itself as an option. Is this just a bug or am I missing something here?
Some example code that replicates the issue:
When I was coding something custom using -program define-, I encountered some behavior I didn't expect. When an option that begins with "no" is fed into a program, it seems to be treated as a logical value rather than, say, a string. Interestingly, you can't begin a string with "N" or just use "no" by itself as an option. Is this just a bug or am I missing something here?
Some example code that replicates the issue:
Code:
program drop _all program define test_prog1 syntax [anything], [test] display "`=("`test'" != "")'" end test_prog1, test program define test_prog2 syntax [anything], [noo] display "`=("`noo'" != "")'" end test_prog2, noo program define test_prog3 syntax [anything], [uno] display "`=("`uno'" != "")'" end test_prog3, uno program define test_prog4 syntax [anything], [N] display "`=("`N'" != "")'" end cap test_prog4, N //"option N not allowed" program define test_prog5 syntax [anything], [nO] display "`=("`nO'" != "")'" end test_prog5, nO program define test_prog6 syntax [anything], [no] display "`=("`no'" != "")'" end cap test_prog6, no //"invalid syntax"
Comment