LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 4 Mar 2008 11:34:44 -0500
Reply-To:   "Curtis E. Reid" <reid.curtis@BLS.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Curtis E. Reid" <reid.curtis@BLS.GOV>
Subject:   Re: Bug in %DO %WHILE while processing a 10-digit numeric value?

It might surprise you that I got the original code from the SAS online documentation v8 some years back. I wasn't trying to modify or anything until I ran into the problem I mentioned earlier.

This can be found in the page titled "%STR and %NRSTR" at http://v8doc.sas.com/sashtml/.

This is the code snippet that I took from the SAS Online Doc and that is what SAS Insitute is using to tell others! :-)

--Curtis E. Reid

Example 2: Protecting a Blank So That It Will Be Compiled As Text This example specifies that %QSCAN use a blank as the delimiter between words.

%macro words(string); %local count word; %let count=1; %let word=%qscan(&string,&count,%str( )); %do %while(&word ne); %let count=%eval(&count+1); %let word=%qscan(&string,&count,%str( )); %end; %let count=%eval(&count-1); %put The string contains &count words.; %mend words;

%words(This is a very long string) Executing this program writes these lines to the SAS log:

The string contains 6 words.


Back to: Top of message | Previous page | Main SAS-L page