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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.