|
Hi there,
Is it possible for a macro parameter to accept a variable name if that
variable already exists, or if not, use it as the value to assign to
another variable?
%macro name(newname=);
data class;
set sashelp.class (obs=2 keep=name);
newname=&newname;
run;
proc print;
run;
%mend;
%name(newname=name);
Obs Name newname
1 Alfred Alfred
2 Alice Alice
%name(newname=Clinton);
Obs Name newname Clinton
1 Alfred . .
2 Alice . .
I want it as
Obs Name newname
1 Alfred Clinton
2 Alice Clinton
This seems to be a very common trick in macro programming, just
can't find an example how it is implemented.
Thanks
Ya
|