DATA A;
INPUT LIBREF$ PATH$;
CARDS;
MYLIB C:\SAS\SAI
MYSAS D:\SAS\RAJA
MYXYZ E:\SAS\RANI
;
RUN;
HERE LIBRARY HAS TO CREATE AS MYLIB IN GIVEN PATH C:\SAS\SAI
LIKE THAT ONE MORE LIBRARY HAS TO CREATE AS MYSAS IN GIVEN PATH D:\SAS\RAJA......
CAN I GET CODE FOR THIS THANK YOU...
Please do not type in all capitals
DATA A;
INPUT LIBREF$ PATH $18.;
call execute(cat('libname ',libref,'"',trim(path),'";'));
CARDS;
MYLIB C:\SAS\SAI
MYSAS D:\SAS\RAJA
MYXYZ E:\SAS\RANI
;
Please do not type in all capitals
DATA A;
INPUT LIBREF$ PATH $18.;
call execute(cat('libname ',libref,'"',trim(path),'";'));
CARDS;
MYLIB C:\SAS\SAI
MYSAS D:\SAS\RAJA
MYXYZ E:\SAS\RANI
;
Very Happy with the code
Can you please explan the code call execute ?
@Saikiran_Mamidi wrote:
Very Happy with the code
Can you please explan the code call execute ?
The CALL EXECUTE creates strings that are placed in the compiler buffer for execution after the data step completes.
@Saikiran_Mamidi wrote:
Very Happy with the code
Can you please explan the code call execute ?
CALL EXECUTE generates SAS code that is run after the DATA step finishes.
So after the data step finishes, the first line created by CALL EXECUTE is:
libname MYLIB "C:\SAS\SAI";
and this runs, then the next line created runs, and so on.
Typing in all caps is yelling on the internet and it's actually hard to read. Please format your questions.
To answer your question use the LIBNAME() function.https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p1bq8nyxm7y1ygn1i4vyf82z68ls.htm...
RC is the return code which indicates if the function was successful.
DATA A;
INPUT LIBREF$ PATH$;
rc = libname(libref, path);
CARDS;
MYLIB C:\SAS\SAI
MYSAS D:\SAS\RAJA
MYXYZ E:\SAS\RANI
;
RUN;
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!
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.