| Date: | Fri, 20 Mar 1998 16:47:24 +0500 |
| Reply-To: | Bernard Tremblay <bernard@CAPITALE.QC.CA> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Bernard Tremblay <bernard@CAPITALE.QC.CA> |
| Subject: | Re: %SCAN and the Semicolon (;) |
|
Hi,
The ";" is a separator for the function scan. If you want to
obtain anything separated by space add a third parameter to %scan to
give it the list of your separator: "%str( )" in this case.
See an example of what I got by modifying your macro:
176 %macro bidon;
177 %LET text1 = %str(pppplllm ; tttttt ; kkkkkk ;) ;
178 %put text1=&text1;
179 %do i =1 %to 10;
180 %let check = %scan(&text1, &i,%str( )) ;
181 %put i=&i check=&check ;
182 %end ;
183 %mend;
184 %bidon;
text1=pppplllm ; tttttt ; kkkkkk ;
i=1 check=pppplllm
i=2 check=;
i=3 check=tttttt
i=4 check=;
i=5 check=kkkkkk
i=6 check=;
i=7 check=
i=8 check=
i=9 check=
i=10 check=
NB: You may want to stop the loop as soon the value of check is a null
value... add: %if %length(&check)=0 then %let i=11; at the end
of the %do loop.
Regards,
Bernard Tremblay
\\\|///
\\ - - //
( @ @ )
+------oOOo-(_)-oOOo----------+---------------------------------+
| Bernard Tremblay | |
| La Capitale | Tel: (418) 646-2401 |
| | Fax: (418) 646-5960 |
| | Int: bernard@capitale.qc.ca |
+-----------------------------+---------------------------------+
| Imaginasys enr | Res: (418) 878-4447 |
| | Int: bertrem@quebectel.com |
+---------------Oooo----------+---------------------------------+
oooO ( )
( ) ) /
\ ( (_/
\_)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>From owner-sas-l@UGA.CC.UGA.EDU Fri Mar 20 16:16 EST 1998
>>>X400-Received: by /PRMD=NATBANK1/ADMD=IBMX400/C=US/; Relayed; Fri, 20 Mar 1998
>>> 16:14:49 -0500
>>>X400-Received: by /PRMD=NATIONSBANK/ADMD=IBMX400/C=US/; Relayed; Fri, 20 Mar
>>> 1998 16:13:19 -0500
>>>X400-Originator: abdu.elnagheeb@LMS
>>>X400-Recipients: sas-l@uga.cc.uga.edu
>>>X400-Mts-Identifier: [/PRMD=NATIONSBANK/ADMD=IBMX400/C=US/;0056440000185534000002L442]
>>>X400-Content-Type: P2-1988 (22)
>>>Content-Identifier: H000083802192845
>>>Date: Fri, 20 Mar 1998 16:13:19 -0500
>>>Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
>>>From: "abdu.elnagheeb(a)nationsbank.com"
>>> <abdu.elnagheeb@NATIONSBANK.COM>
>>>Subject: %SCAN and the Semicolon (;)
>>>To: SAS-L@UGA.CC.UGA.EDU
>>>Content-Type: text
>>>Content-Length: 454
>>>
>>> Hello everyone,
>>>
>>> It seems that %SCAN can't catch the semicolon (;). For example, if
>>> you have (parts of a macro):
>>>
>>> %LET text1 = %str(pppplllm ; tttttt ; kkkkkk ;) ;
>>>
>>> %do i =1 %to 9999;
>>> %let check = %scan(&text1, &i) ;
>>> %end ;
>>>
>>> the macro variable check will NEVER assume the value ';' . Am I
>>> wrong?
>>>
>>> What else can one do to capture the semicolon there?
>>>
>>> Thanks and have a nice weekend.
>>>
>>> abdu
>>>
|