BookmarkSubscribeRSS Feed
ybz12003
Rhodochrosite | Level 12

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;

5 REPLIES 5
Kurt_Bremser
Super User

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.

ybz12003
Rhodochrosite | Level 12

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.

 

Kurt_Bremser
Super User

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.

ybz12003
Rhodochrosite | Level 12

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;

Shmuel
Garnet | Level 18

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;

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 5 replies
  • 1434 views
  • 0 likes
  • 3 in conversation