&macvar
to obtain the
value of a macro variable before a DATA step executes. Now, suppose
you want to obtain the value of a macro variable during DATA step
execution. You can obtain a macro variable's value during DATA step
execution by using the SYMGET function. The SYMGET function returns
the value of an existing macro variable.
General form, SYMGET
function:
SYMGET(macro-variable)
macro-variable
can be specified as
one of the following:
|
Teacher
is
assigned the value of the macro variable teach
n for
each observation in the Sasuser.Register data set, where n is
the value of the data set variable Course_number
for
that observation.
teach
n has
already been created for each observation in Sasuser.Register.
data teachers;
set sasuser.register;
length Teacher $ 20;
teacher=symget('teach'||left(course_number));
run;
proc print data=teachers;
var student_name course_number teacher;
title1 "Teacher for Each Registered Student";
run; |
|
Teacher
and that the values of this
variable are the same as the values of the macro variables teach1-teach3
in
the global symbol table above.