Published on :
Macro CREATION_INTERNE

AHGscanDim Macro - Sequential Word Extraction

This code is also available in: Deutsch Español Français
This macro retrieves three consecutive tokens (words) from a source string (`str`). The starting index is determined by the formula `(dimNum-1)*by`. The macro returns elements at calculated positions +1, +2 and +3. It should be noted that the `dlm` parameter (delimiter) is present in the signature but is not used in the `%scan` calls within the macro body (default delimiters therefore apply).
Data Analysis

Type : CREATION_INTERNE


The code only performs string manipulations in SAS macro language without data access.

1 Code Block
MACRO
Explanation :
Defines the macro that concatenates the results of three successive %scan functions to extract adjacent text segments.
Copied!
1%macro AHGscanDim(str,dimNum,BY=2,dlm=%str( ));
2%scan(&str,%eval(( &dimNum-1)*&BY +1)) %scan(&str,%eval(( &dimNum-1)*&BY +2)) %scan(&str,%eval(( &dimNum-1)*&BY +3))
3%mend;
4 
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.