If you are going to use shared variables (which is, at best, questionable) then the "best practice" is to always define them as NEW GLOBAL SHARED.
That way they always exist and there is only one instance with a given name. (The "new" is ignored if it already exists.) If you leave out the GLOBAL then "new" behaves as you have observed -- at run time the variable must already be defined somewhere. You can also, potentially, have more than one instance of the variable with that name and the one available to your program depends on where you are in the call stack. And that is hardly ever what you really want.