![]() | ![]() | ![]() | ![]() |
If you need a quick way to access the SAS WORK library in a SAS/CONNECT server session, here are several methods:
The simplest way of attaching to a remote WORK library uses only a simple LIBNAME statement with the SLIBREF= option. With this one-liner, you don't even need the remote submit statement since these capabilities are built into SAS/CONNECT's remote library services. Remote library services allows you to access SAS data on a remote host, regardless of machine architecture, as if it were local. Once this libname statement has been executed, you can use the remote WORK library as if it were on your local machine. Note: The SERVER= value of dilbert used in these examples should be replaced with the remote session id that you specify with your SIGNON statement. Put the following code after your SIGNON statement when establishing your SAS/CONNECT session.
libname rwork slibref=work server=dilbert; |
If the local and remote SAS sessions are on two physically separate machines, the server= option is needed so that the remote WORK library is available to the local SAS session. However, if you are spawning multiple sessions on an SMP machine, all of the WORK libraries are on the same machine and you need only the physical path. You would not issue the server= option on the LIBNAME statement. The code would simply be:
rsubmit; %sysrput rwork=%sysfunc(pathname(work)); endrsubmit; libname rwork "&rwork"; |
This solution uses the SQL procedure to extract the automatically assigned WORK directory from the dictionary.options table. It then passes the value back to the local session and establishes a libname to the remote WORK library using SAS/CONNECT's remote library services. (Remote library services allows you to access SAS data on a remote host, regardless of machine architecture, as if it were local.) Once this code has been executed, you can use the remote WORK library as if it were on your local machine.
Put the following code immediately after your SIGNON statement when establishing your SAS/CONNECT session. Note: The SERVER= value of dilbert used in these examples should be replaced with the remote session id that you specify with your SIGNON statement.
rsubmit; proc sql noprint; select distinct setting into :workdir from dictionary.options where optname='WORK'; quit; %sysrput rwork=&workdir.; endrsubmit; libname rwork "&rwork." server=dilbert; |
Results
libname rwork "&rwork." server=dilbert; NOTE: Libref RWORK was successfully assigned as follows: Engine: REMOTE Physical Name: /shared2/tmp/SAS_work1B5100003C3E_dilbert |
About the Authors
Brian Varney is manager of Strategic Projects for Venturi Technology Partners (formerly Trilogy Consulting). With more than 14 years of SAS experience, Brian is a recognized expert in the SAS arena as both a high-level consultant and SAS trainer. Venturi's SAS specialty group, known as the "National SAS Practice," is a SAS Gold Alliance Partner with more than 20 years of on-site and off-site SAS consulting experience. You may contact Brian by e-mail at BVarney@VenturiPartners.com or by phone 269-344-4100, extension 110
Cheryl Doninger is the Research Development Director for SAS/CONNECT software. She has been with SAS since 1986.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | Non SAS Authors ==> Brian Varney |
Date Modified: | 2005-02-02 12:47:41 |
Date Created: | 2004-10-15 08:47:11 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/CONNECT | All | n/a | n/a |