BookmarkSubscribeRSS Feed
RVA
Fluorite | Level 6 RVA
Fluorite | Level 6

Right now, whenever I want to bring a data set from the server workspace to the local workspace,  I have to point and click on the data set to build a query and then choose the local server.  Are there any code lines that can achieve this task so that I can put them in my run and therefore do not have to do the point-and-click anymore?

Thank you

8 REPLIES 8
SASKiwi
PROC Star

As I understand it the only way to transfer SAS data in EG is to use the EG transfer data tasks. These do not run SAS code behind the scenes, so unfortunately there is no code-based alternative.

If you can access your remote SAS server data folders from your PC (most likely if your SAS server runs on Windows), you could assign a LIBNAME for the remote folder and read your SAS data that way:

libname remote "\\SASServerName\SASDataFolder";

libname local "C:\SASDataFolder";

proc copy in = remote out = local;

  select datasetname;

run;

Patrick
Opal | Level 21

To establish direct SAS Server to SAS Server communication you need SAS/Connect licensed and installed. If that's the case then you can transfer data between servers using SAS code.

SASKiwi
PROC Star

In Patricks solution you would also need to switch to using the SAS Display Manager client for data transfers in code - the UPLOAD and DOWNLOAD procedures.

Using EG would only be possible if you could CONNECT from your remote SAS server back to your PC in which case you could  UPLOAD and DOWNLOAD to your PC via remote SUBMITs.

Patrick
Opal | Level 21

....or you run from the local server and execute on the remote server within rsubmit blocks.

SASKiwi
PROC Star

True. That would require switching to Display Manager though which the OP may or may not want to do.

SAS/CONNECT and EG don't know about each other even when you have both a local and remote SAS server. With EG you could run a program on the remote SAS server that RSUBMIT's back to your PC and UPLOADs SAS data (its an upload in this case because your PC is the server and EG SAS remote server is the client - confusing) to it. I'm not able to try it though as I have no local SAS only EG - a common scenario these days.

Patrick
Opal | Level 21

I don't really get why things shouldn't work with EG. The EG client is simply sending code to a server for execution (be it local or remote). So if you send code to a local server and then in this code is the connection to the remote server done (withing an rsubmit block) why shouldn't that work?

I don't think it will be possible to connect from a remote server to a local server (run on a local machine). That's something most sites won't allow.

I believe with more modern versions of EG it's now also possible to run different nodes in the same flow against different servers. So another option using EG would be to write to a permanent tables in the one node under the remote server to a location which is also accessible to the local server - and then in the next node access this data via the local server.

Karthikeyan
Fluorite | Level 6

This is what we usually do , our SAS resides on the Unix Server and we use rsubmit to execute the code at the unix end.

For the Datasets , we create a libname inside the rsubmit block and we refer the same libname outside the rsubmit by using another libname . like

RSUBMIT;

libname test_dat  '/home/user/xxxyyy/ttttt/';

ENDRSUBMIT;

libname test_dat slibref = test_dat server = unix; (We name our server as unix while establishing the connection)

That's it ... you're free to use the remote datasets like the local datasets , but beware of the file sizes. The approach works well for smaller datasets , for larger files I would use a ftp tool and move the datasets to local.

RVA
Fluorite | Level 6 RVA
Fluorite | Level 6

Many thanks, everyone.  I got the idea now.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 8 replies
  • 11686 views
  • 0 likes
  • 4 in conversation