Date: Fri, 28 Oct 2005 11:34:35 -0400
Reply-To: Chris Brooks <Chris.Brooks@ONS.GOV.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chris Brooks <Chris.Brooks@ONS.GOV.UK>
Subject: Re: Searching macrovar for a comma
If I've interpreted the problem correctly and you have SAS 9 you could use
the countc function like this
Office for National Statistics
On Fri, 28 Oct 2005 10:02:30 -0400, Steve Raimi <steven.raimi@GM.COM>
>I'm trying to add some error-trapping in a macro to make sure the user
>doesn't use commas or other reserved characters in a list that should be
>space-delimited. I think %sysfunc(indexc(source,excerpt-1<,excerpt-
>2...excerpt-n>)) is the right way to go, but indexc allows multiple test
>excerpts, and will interpret any comma as delimiting the list of excerpts.
>It seems to be a Catch-22. Within %sysfunc, function arguments that would
>otherwise be quoted have to forego the quotation marks. Macro quoting
>functions will unprotect the comma character when exposed to the indexc
>function, which will then interpret it as indicating another excerpt will
>be supplied (not as part of an excerpt to be tested). Without any special
>handling, comma will also be interpreted that way.
>I'm sure I'm not the first to encounter this problem, but I can't find an
>answer in the archives. Can someone help?