%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.
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
);
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
);
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.