expglm | Expand a GLM model specification from bar notation | expglm |
The expglm macro expands shorthand GLM/GENMOD model notation using the | and @ symbols to a blank-separated list of main effect and interaction terms. Useful for macros which need to deal with the terms separately, or for procs which do not allow | notation.
The macro argument should be a string of legal SAS variable names separated by blanks for separate model terms, optionally including the | and @ symbols. The macro returns an expanded string from the macro argument, for example
%let model = %expglm(A|B|C);
%expglm(A|B) --> A B A*B; %expglm(A|B A|C) --> A B A*B C A*C; %expglm(A|B|C@2) --> A B A*B C A*C B*C;
Doesn't check syntax, or respond gracefully to ill-formed models.
No blanks are allowed inside any term, certainly not inside ()
Doesn't handle nested effects properly, but this is beyond what can be done using pure macro processing.
A|B(A) should --> A B(A) A(B)|C(D) should --> A C A*C(B*D)