When I want to run this macro:
%macro prep_graph(Tab_Input=,stat=,var=);
proc transpose data=&Tab_Input out=&stat._&var._PRE(drop=_name_);
by RatingClassFirstAv;
id Age;
var &stat._&var.;
run;
proc transpose data=&stat._&var._PRE out=&stat._&var._graph
(rename=(_NAME_ = Age));
id RatingClassFirstAv;
run;
proc sql;
create table &stat._&var._graph as
select input(Age, 4.) as Age, *
from &stat._&var._graph ;
quit;
proc sort data=&stat._&var._graph ;
by Age;
run;
proc transpose data=&stat._&var._graph out=&stat._&var._PRE (rename=(_NAME_ = RatingClassFirstAv));
id Age;
run;
%mend prep_graph;
%prep_graph(Tab_Input=Stat, stat=Avg, ,var=PD);
I've got an message:
WARNING: Apparent invocation of macro PREP_GRAPH not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
And when I run everything without macro, it works perfectly.
How to resolve it?
You have entered a missing surplus argument invoking the macro
%prep_graph(Tab_Input=Stat, stat=Avg, ,var=PD);
replace with
%prep_graph(Tab_Input=Stat, stat=Avg,var=PD);
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.