Hello:
I have a 'Template' file saved in the ZK file. Everytime, I need to open libname then use data step to input into work library. Is there a way to link to the 'Template' file and send it to the work library directly? Thanks.
libname ZK "\\abb.org\ybz12003\Test";
data template; set ZK.template; run;
You can use your dataset from USER directly. No need to copy it to WORK.
Since WORK is a dynamic location that is created when a SAS process starts and deleted when the SAS process terminates, you cannot create anything permanent in it.
Sorry, I probaby should not use the 'USER'. Below is my acturaly code.
1 data zk.itemplate;
2 set template;
ERROR: File WORK.TEMPLATE.DATA does not exist.
3 run;
ERROR: Libref ZK is not assigned.
NOTE: The SAS System stopped processing this step because of errors.
That tells you two things
- library zk is not assigned
- there is no dataset template in work
If template exists anywhere, use the correct library for it. If the library is not yet assigned, assign one.
That is what I am asking. I need to assign one libname and run data step to assign 'Template' file to work library. I am looking for if I could combine below two steps into one step. Thanks.
libname ZK "\\abb.org\ybz12003\Test";
data template; set ZK.template; run;
Does your code run as is? Yes means you have the template dataset in your WORK library.
If you want to save the template in your own library, so that you do not run same code each time you start SAS,
than define your own library and save it there:
libname ZK "\\abb.org\ybz12003\Test";
libname user "...your path ..."; /* you can change name from USER to any other name */
data user.template;
set ZK.template;
run;
Next sas session use as:
libname user "...same path as origin ...";
data want;
set user.template;
...any code ...
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.