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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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