BookmarkSubscribeRSS Feed
DavidPhillips2
Rhodochrosite | Level 12

I'm trying to use BASE SAS connected to no profile to query a SAS dataset on one metadata server bring it in locally and upload the dataset to another SAS server.  Is this done using libnames?  Is the connection done using libnames with port, login, metadata server name?  Is there documentation on this?

7 REPLIES 7
gwootton
SAS Super FREQ
The SAS Metadata Server stores information about where a library is located rather than storing the datasets themselves. Typically the libraries are stored on the compute tier so they are accessible by the SAS sessions trying to access them. If you have two SAS environments and you want to move a data set from one to the other I think you would need to use SAS/CONNECT to establish a SAS session on each environment and proc upload/download to move the data set between them.
--
Greg Wootton | Principal Systems Technical Support Engineer
Kurt_Bremser
Super User

If the SAS session in question has access to the directory where the datasets reside, and the library is not metadata-bound, you simply define a LIBNAME.

If you do not have access to the directory via the filesystem, but can establish a SSH session to the target server, just use sftp to copy the sas7bdat file. Unless the target library is encrypted.

DavidPhillips2
Rhodochrosite | Level 12

I googled metadata bound, I'm still trying to figure it out but I don't think I am using metadata bound libraries because normally in Enterprise Guide I just select my connection and connect to these libraries using libname calls like libname test meta library="test library";  How do I check if I have directory access?  I'm using no profile with BASE SAS I found I can switch between metadata servers using.  

options metaserver=&metaserver
metaport=8561 
metauser="xxx"
metapass="xxx" 
metaprotocol=bridge 
metarepository=Foundation;

 

But after connecting I can't call the libraries like I could if I was connected using a profile.  The SFTP method sounds great.  Is there documentation on this?  The SFTP and SAS connect might be the same thing.  I'm reading up on SAS connect.

gwootton
SAS Super FREQ
When you connect to a SAS environment (profile) using Enterprise Guide, you connect to a Workspace Server running on that environment rather than one running on your local machine, which knows how to connect to its associated Metadata Server.
When you use the META libname engine, it will pull the location of the library from Metadata, and that location is in relation to where the Workspace Server is running (i.e. /path/to/library on the compute tier of that environment).
If that library is Metadata bound, the file is encrypted and the encryption key is stored in Metadata, and only available to users with permission to read the library.

If you are not using a profile with Enterprise Guide you are running SAS on your local machine. So even if you establish a connection to Metadata and run a libname statement, the referenced path (/path/to/library) probably will not exist on your local host. In this case, the files would need to be accessible to your local machine through a network share or copied to your local machine.
Similarly if you want to connect to a different environment (different profile) and have the library be available there the files would need to be accessible to that host through being copied or a network share.

If your goal is to copy the files (<dataset>.sas7bdat) to the new server, this would most easily be done outside of SAS through OS commands and facilities like scp on UNIX or Windows shares on Windows, or by putting the files on shared storage accessible to both environments.
--
Greg Wootton | Principal Systems Technical Support Engineer
SASKiwi
PROC Star

What OS do your SAS servers run on? If they are running Windows then you can easily read data from them from SAS running on your PC by assigning a LIBNAME like so:

libname SASSVR '\\MySASServer\MyServerSASFolder';

The one caveat is you need to be running 64-bit SAS on your PC to match the bitness of your server SAS.

DavidPhillips2
Rhodochrosite | Level 12

Our servers run on Linux

SASKiwi
PROC Star

@DavidPhillips2  - You could use SAS/Connect then as SAS datasets structure is different between Windows and Linux. You could connect to one SAS server using an EG profile then use SAS/Connect to link to another SAS server. We use this technique ourselves and it works very well. SAS/Connect though has to be installed and licensed on both servers.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1327 views
  • 1 like
  • 4 in conversation