BookmarkSubscribeRSS Feed
BarryP
Quartz | Level 8

Hi, 

in SAS Enterprise Guide I am required to select which server I am working in using the drop down at the top of the page.  What if I wanted to merge tables from different servers?

 

If they are on the same server, I would select it and write:

Data Table_I_Want;

     merge LIBID1.Table_I_Have1 LIBID2.Table_I_Have2;

     by Common_Field;

run;


Thanks!

8 REPLIES 8
Reeza
Super User

You can’t in EG, but you can in Base SAS - with a caution, it downloads both of the data sets to do the merge so it’s not super efficient. 


@BarryP wrote:

Hi, 

in SAS Enterprise Guide I am required to select which server I am working in using the drop down at the top of the page.  What if I wanted to merge tables from different servers?

 

If they are on the same server, I would select it and write:

Data Table_I_Want;

     merge LIBID1.Table_I_Have1 LIBID2.Table_I_Have2;

     by Common_Field;

run;


Thanks!


 

ChrisNZ
Tourmaline | Level 20

All the data needs to be on the same server to be merged.

So you must move data sets. There are several ways to do this, but this is an inescapable requirement.

Can you use SAS/Connect to connect from one server to the other?

 

It works like this:

choose SERVER1 from the dropdown menu in EG

and submit:

signon SERVER2;

This will make SERVER1 try to connect to SERVER2.

 

You need to supply the correct connection parameters.

Ask your administrator if SAS/Connect is available, and what the parameters are.

 

If not, you have to copy the data manually from one server to the other, either via Windows explorer or via EG (copy and paste). This can be very slow.

 

ChrisNZ
Tourmaline | Level 20

A third way would be to define a UNC libname.

 

For example run this on SERVER1:

libname SVR2 '\\SERVER2\path';

 

BarryP
Quartz | Level 8

Thanks for the help, but I still don't understand how I would do this.

 

If I'm on server1 and type:

set Library_Name.Table


Its going to assume that the library is on server1.  How would I get it to server2?  Or how would I copy from server2 into the work library of server1?



Right now the only thing I would know how to export the table from server2 and then use the import wizard to get it back into server1.  

ChrisNZ
Tourmaline | Level 20

Like this?

libname SVR1 '\\SERVER1\path';
libname SVR2 '\\SERVER2\path';
data MERGED;
  merge SVR1.TAB1 
        SVR2.TAB2;
 run;

 

BarryP
Quartz | Level 8

Okay, I think I know what to do here.  I'll try it out tomorrow and let you know how it goes.



When you say 

libname SVR1 '\\SERVER1\path';

You simply mean the libname statement that I can look up in SAS Console Manager.  Correct?

Thanks!

ChrisNZ
Tourmaline | Level 20

I don't know what you have in your Console manager.

 

This is the local library.

Patrick
Opal | Level 21

@BarryP 

For merging/joining all the data must be on the same server (your Server1). 

You can either find a way to issue libname statements which can access all the data you need - the libnames with UNC paths as proposed. That's the easiest way if it works.

 

If you have SAS/Connect licensed then you can also use remote library services. Such a library definition allows you to transparently access data via a remote SAS server (your Server2).

 

How this works is documented here (the SAS/Connect client in the docu is your Server1 to which you connect via SAS EG):

https://go.documentation.sas.com/?docsetId=connref&docsetTarget=p12j8b6w2nuxpon15xu0fqsisfkk.htm&doc...

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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