sas mac

Reply
Contributor
Posts: 62

sas mac


%macro nn(dt);
%do i=1 %to 3;
%let x=%sysfunc(scan("&dt",&i,',');
%put &x;
data t;
set &x;
run;
proc print;run;
%end;
%mend;
%nn(one,two,three);

want to print all the three data sets,getting error that More positional parameters found than defined.

Contributor
Posts: 56

Re: sas mac

You are passing three parameter (one , two , and three), while only defining one parameter to be passed (dt).

 

You can either quote what you are trying to pass to the macro

 

%nn(%quote(one,two,three))

Or, you can modify the macro to include a space as a delimiter in your scan function and pass the parameter separated by spaces.

%macro nn(dt);
%do i=1 %to 3;
%let x=%sysfunc(scan(&dt,&i,', '));
%put &x;
data t;
set &x;
run;
proc print;run;
%end;
%mend;
%nn(one two three)

 

 

Trusted Advisor
Posts: 1,137

Re: sas mac

please try to call the macro as %nn(%nrstr(one,two,three))
Thanks,
Jag
Ask a Question
Discussion stats
  • 2 replies
  • 273 views
  • 0 likes
  • 3 in conversation