SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 26155: Loop through a nonsequential list of values with a macro DO loop

DetailsCodeOutputAboutRate It

In the macro language, there is not an equivalent to the following DATA step code:

   do i=2,3,5,7,11,13,17;

In order to do this within the macro language, the individual values are passed to the macro and each value is read using %QSCAN. The COUNTW function is used to count the number of words in the string using the comma as the delimiter.

Click on the Full Code and Output tabs to see the code and output.




These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.