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

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