BookmarkSubscribeRSS Feed
rkumar23
Calcite | Level 5

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 ?

2 REPLIES 2
rkumar23
Calcite | Level 5

got it resolve..thanks...

Ksharp
Super User

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 700 views
  • 0 likes
  • 2 in conversation