BookmarkSubscribeRSS Feed
JovanaUniCredit
Calcite | Level 5

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?

1 REPLY 1
Shmuel
Garnet | Level 18

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);

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1317 views
  • 0 likes
  • 2 in conversation