r1 - 26 Nov 2008 - 16:05:07 - ArthurWatts?You are here: TWiki >  CTSpedia Web > StatisticalTools > SasTools > UtilityMacros > NextWord
* Macro function NextWord returns the first word from a string, and removes
the first word from the list. The macro parameter is:
string = a string of words.

example: %Let next=%NextWord(string) ;


%Macro NextWord(string);
%Let space=%Index(&&&string,%Str( ));
%Let size=%Length(&&&string);
%If %Eval(&space)>0 %Then %Do;
%Let NextWord=%Substr(&&&string,1,&space);
%Let &string=%Substr(&&&string,&space+1,&size-&space);
%End; %Else %Do; %Let NextWord=&&&string; %Let &string= ; %End;
&NextWord
%Mend NextWord;
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
CTSpedia knowledge base
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Content on CTSpedia is covered by disclaimers.

Copyright © by the contributing authors.
Ideas, requests, problems regarding CTSpedia? Send feedback
This site is powered by TWIKI.NET's Certified TWikiPowered by TWIKI.NET