Date: Thu, 26 Feb 2004 15:13:26 +0000
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <iw1junk@COMCAST.NET>
Subject: pound sign causes macro problems in Version 9.1
Wanda, Don, etc.
As Ron pointed out, the introduction of a # as a macro operator is not a bug.
It was done by design. In fact it was done to answer a string of complaints
from SAS-L that macro had no IN operator. On the other hand, the fact that #
cannot be macro quoted is a bug or at least the failure to allow quoting when
introducing new operator symbols.
Now the search for # in programs should be fairly easy, since the only other
place it occurs in he language is as a row indicator in PUT statements.
However, # is a symbol for IN, so there is also a new word to watch out for.
If you have used the word IN in character strings which will be viewed by
%EVAL then you will run into the same problem that Wanda has discovered. But in this case searching for the word IN in programs may prove much harder.
Fortunately, I suspect that the use of IN in such contexts will probably be
%let vars = a#n b#c ;
%if %superq(vars) ...
will work where other quoting functions do not. If not then I hope the bug
gets fixed. Personally, I would prefer
%let vars = a/n b/c ;
since in SAS the slash is used to mean modifying option following, and I prefer
to follow SAS syntax whenever possible. On the other hand, I have used # in
some parsing contexts because it is a symbol that stands out.
Now, are the problems created worth getting what many have asked for? Every
gift has a cost so one should learn to consider the costs when making the next request for a new language feature. I find it interesting that in this case the problem was caused by the fact that # did not previously have a meaning in macro, and it was chosen for that reason. However, Wanda, Don, and presumably many others have chosen the # for their own use for precisely the same reason.
Perhaps the quoting functions should quote all symbols to avoid this bug in the future.