BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Aditi24
Obsidian | Level 7

 

%macro test(s_no=
,libname1 = 
,libname2 = 
,libname3 = 
,libname4 = 
);
libname inputt "&libname1";
libname interim "&libname2";
libname output "&libname3";
libname dataa "&libname4 ";
%mend test;
%test(
s_no=1234;
,libname1 = C:\Users\abc\Desktop\input; 
,libname2 = C:\Users\abc\Desktop\interim;
,libname3 = C:\Users\abc\Desktop\output;
,libname4 =C:\Users\abc\Desktop\test;
);

I am getting 
Note: Library doesn't exist error while running this code. Please let me know what am I doing wrong.

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Drop the semicolons in your arguments like this

 

%macro test(s_no=
,libname1 = 
,libname2 = 
,libname3 = 
,libname4 = 
);
libname inputt "&libname1";
libname interim "&libname2";
libname output "&libname3";
libname dataa "&libname4 ";
%mend test;
%test(
 s_no = 1234
,libname1 = C:\Users\abc\Desktop\input 
,libname2 = C:\Users\abc\Desktop\interim
,libname3 = C:\Users\abc\Desktop\output
,libname4 = C:\Users\abc\Desktop\test
);

 

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Drop the semicolons in your arguments like this

 

%macro test(s_no=
,libname1 = 
,libname2 = 
,libname3 = 
,libname4 = 
);
libname inputt "&libname1";
libname interim "&libname2";
libname output "&libname3";
libname dataa "&libname4 ";
%mend test;
%test(
 s_no = 1234
,libname1 = C:\Users\abc\Desktop\input 
,libname2 = C:\Users\abc\Desktop\interim
,libname3 = C:\Users\abc\Desktop\output
,libname4 = C:\Users\abc\Desktop\test
);

 

Kurt_Bremser
Super User

Omit the semicolons after the macro parameters. Those semicolons otherwise end up as part of the directory names.

%macro test(s_no=
,libname1 = 
,libname2 = 
,libname3 = 
,libname4 = 
);
libname inputt "&libname1";
libname interim "&libname2";
libname output "&libname3";
libname dataa "&libname4";
%mend test;
%test(
s_no=1234
,libname1 = C:\Users\abc\Desktop\input
,libname2 = C:\Users\abc\Desktop\interim
,libname3 = C:\Users\abc\Desktop\output
,libname4 =C:\Users\abc\Desktop\test
);

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 907 views
  • 0 likes
  • 3 in conversation