Date: Mon, 7 Feb 2005 21:38:36 +0000
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <iw1junk@COMCAST.NET>
Subject: Bug in %SCAN (was Re: %substrw)
Well-written macro! Two suggestions:
Test case 1:
%let s1= %selwseq(%str(a, b, c, d), 2, 2, dlim=%str(,));
It returns "b C" instead of "b, c"
Test case 2:
%let s2 = %selwseq(%str(a, b, max(c,d), d), 2, 2, dlim=%str(,));
It returns "b max(c". I
It will be better if the macro can return "b, max(c,d)"
Thanks. I do not get the problem that you indicate in case 1, when running
the Learning Edition 126.96.36.199 under Windows XP.
Fixing the problem that you indicate in case 2 would be hard since %SCAN
does not support this sort of thing. Incidentally, in thinking about this
response I tried the following.
WARNING: Only the Base product and the SAS/STAT product have been tested
for use with
VALIDVARNAME=ANY. Other use of this option is considered
experimental and may cause
2 OPTIONS VALIDVARNAME=ANY;
NOTE: Some of your options or statements may not be supported with the
activex or java devices.
For further information, please contact Technical Support.
3 OPTIONS DEV=ACTIVEX;
4 ODS LISTING;
5 %put ===========================;
ERROR: Open code statement recursion detected.
6 %put %scan ( a "b c", 2 , %str( )) ;
7 %put ===========================;
Anyone have any idea where the recursion is coming from? I get the same
result in version 9.1.2 with macro quoting by %SUPERQ. Although SCAN works as expected, you cannot cheat and use
%SYSFUNC(SCAN( a "b c", 2 , %str( )))
since it has the same recursion problem. However SCAN in a DATA step works as expected yielding "b.