Taking an example from a SAS book: The code is: %global %scan(&varlist, &wrd)max;
Say, %scan(&varlist, &wrd) evaluates to 'age'.
The %global statement then creates the macro variable 'agemax'.
I cannot find documentation that tells me that this %global statement concatenates the results of %scan with 'max'. Can anybody point me to that?
Once the macro processor has finished processing something like:
%scan(age sex race,1)max
The resulting string "agemax" is then used in evaluating the larger expression it is part of. So
%global %scan(age sex race,1)max ;
Becomes
%global agemax ;
This type of text substitution is the exactly what "macro processors" are used for in any language, whether it is SAS , assembly or C.
In macro language, this
%scan(&varlist, &wrd)max
is the concatenation.
Once the macro processor has finished processing something like:
%scan(age sex race,1)max
The resulting string "agemax" is then used in evaluating the larger expression it is part of. So
%global %scan(age sex race,1)max ;
Becomes
%global agemax ;
This type of text substitution is the exactly what "macro processors" are used for in any language, whether it is SAS , assembly or C.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.