Desktop productivity for business analysts and programmers

Bring a data set from server to local workspace

Reply
Contributor RVA
Contributor
Posts: 21

Bring a data set from server to local workspace

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

Respected Advisor
Posts: 3,069

Re: Bring a data set from server to local workspace

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;

Respected Advisor
Posts: 3,841

Re: Bring a data set from server to local workspace

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.

Respected Advisor
Posts: 3,069

Re: Bring a data set from server to local workspace

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.

Respected Advisor
Posts: 3,841

Re: Bring a data set from server to local workspace

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

Respected Advisor
Posts: 3,069

Re: Bring a data set from server to local workspace

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.

Respected Advisor
Posts: 3,841

Re: Bring a data set from server to local workspace

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.

Contributor
Posts: 37

Re: Bring a data set from server to local workspace

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.

Contributor RVA
Contributor
Posts: 21

Re: Bring a data set from server to local workspace

Many thanks, everyone.  I got the idea now.

Ask a Question
Discussion stats
  • 8 replies
  • 2011 views
  • 0 likes
  • 4 in conversation