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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 878 views
  • 0 likes
  • 3 in conversation