Hi:
Tim has pointed you to the documentation. That's a good reference. This is also a good paper on the basics of SAS Macro processing.
http://www2.sas.com/proceedings/sugi28/056-28.pdf
The program below has several examples of using the SAS Macro facility inside PROC REPORT. The phrase "calling a macro" generally implies that you are calling a macro program. The %GENCD macro program is being called or invoked several times within the PROC REPORT program. At compile, each of these invocations will be turned into a CALL DEFINE statement. Then, at execution time, the CALL DEFINE statement may or may not be executed, depending on the values being processed by each COMPUTE block.
The SAS Macro facility will only generate code. When the macro trigger of '%' is encountered, the macro facility word scanner will take over to resolve any macro triggers. So, by the time the word scanner is done, a syntactically correct CALL DEFINE statement will be generated inside the PROC REPORT code. When the PROC REPORT code is sent forward to the compiler, there will be NO macro triggers left in the code. In this way, the Macro facility is acting as a typewriter to type code for me. It would not be appropriate to have a macro program, inside PROC REPORT, generate a PROC MEANS, PROC SQL, etc step or a DATA step -- or try to perform any kind of processing that is not normally possible inside a COMPUTE block
Another form of macro trigger is the '&', which you can see in the macro variable reference &SPHD. As with the % trigger, the &SPHD will be resolved at compile time and the string 'Average' will be substituted for the macro variable &SPHD in the column statement.
cynthia
[pre]
%macro gencd(chgs=,color=);
%if &chgs = yes %then %do;
call define(_col_,'style',"style={background=&color}");
%end;
%else %if &chgs = url %then %do;
call define('name','style','style={url="http://www.sas.com"}');
%end;
%mend gencd;
%let sphd = Average;
options mlogic symbolgen mprint;
ods html file='c:\temp\usemacro.html' style=sasweb;
proc report data=sashelp.class nowd;
column sex name age ("&sphd" height weight);
define sex / order;
define name / order;
define age / display;
define height /mean;
define weight / mean;
rbreak after / summarize;
compute height;
if height.mean lt 60 then do;
%gencd(chgs=yes,color=cyan)
end;
endcomp;
compute weight;
if name = 'Barbara' then do;
%gencd(chgs=url)
%gencd(chgs=yes, color=cx6495ed)
end;
else do;
if weight.mean gt 100 and _break_ = ' ' then do;
%gencd(chgs=yes, color=yellow)
end;
end;
endcomp;
run;
ods _all_ close;
[/pre]