Is there a more elegant way in COS just to check that variable is set?
The tricky one I can guess is the next one:
set test = ""
write $get(test, "NO") '= "NO"
But the test
variable can also be equal to "NO"
...
You can use $Data(var)
for that. Documentation.