DATA Step, Macro, Functions and more

Passing values to Macro

Reply
Frequent Contributor
Posts: 78

Passing values to Macro

I am trying to achieve something as below....

I have a Main macro say with MAIN1  and within MAIN1 i have another macro with MAIN2 and Both MAIN1 & MAIN2 need to have certain values to be passed when they run so I have below in the coding.

%Macro main1(X1,X2,X3,X4);

Data xx;

%Put "&X1";

%MAIN2(&X2,&X3,&X4);

%Mend main1;

Now I am running above macro as below:

%Main1(x1=1,x2=6,x3=8,x4=10);          

with above run it shows me error ERROR: MORE POSITIONAL PARAMETERS FOUND THAN DEFINED.  

Any idea how we pass the variables to MAIN2 ?

Frequent Contributor
Posts: 78

Re: Passing values to Macro

got it resolve..thanks...

Super User
Posts: 10,023

Re: Passing values to Macro

You mixed up two ways of defining macro variable(parameter  macro variable  and  position macro variable).


%Macro main1(X1=,X2=,X3=,X4=);

Message was edited by: xia keshan

Ask a Question
Discussion stats
  • 2 replies
  • 172 views
  • 0 likes
  • 2 in conversation