BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fri0
Quartz | Level 8

Hi, I need to know how to move a table in a library in a server to another library in another server.

I have a table in the library Work in the server SASMain and I need to copy or move it to the library Work but in another server named PSASD01. How could I do that?

I was looking for a possible answer but I found this kind of code:

LIBNAME lib1 'SAS-data-library';

LIBNAME lib2 'SAS-data-library';

PROC DATASETS;

COPY IN=lib1 OUT=lib2 MOVE;

SELECT member1 member2;

RUN;

where 'SAS-data-library' is replaced by a path in the pc as 'C:\temp', but in my case is not a path in my computer but it's a libray in a server. Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
snoopy369
Barite | Level 11

Can you access that in windows explorer?  IE, I might have a NAS store in:

//mycompanysnas/sasfiles/myfolder/projectname/

that I could just open in Windows Explorer.  If I can do that (on the machine running SAS, whether that's your local server/installation or you have a windows or whatever server running SAS that you use EG to connect to), then you can just write the libname that way:

libname servlib "//mycompanysnas/sasfiles/myfolder/projectname/";

Then you can use it as a normal library - proc copy to your heart's content.

If you can't access it directly, you'll want to provide more information - are you running this locally or on a SAS Server; does this other server also have a SAS server running; are you using SAS CONNECT, Enterprise Guide, etc.?

View solution in original post

12 REPLIES 12
snoopy369
Barite | Level 11

Can you access that in windows explorer?  IE, I might have a NAS store in:

//mycompanysnas/sasfiles/myfolder/projectname/

that I could just open in Windows Explorer.  If I can do that (on the machine running SAS, whether that's your local server/installation or you have a windows or whatever server running SAS that you use EG to connect to), then you can just write the libname that way:

libname servlib "//mycompanysnas/sasfiles/myfolder/projectname/";

Then you can use it as a normal library - proc copy to your heart's content.

If you can't access it directly, you'll want to provide more information - are you running this locally or on a SAS Server; does this other server also have a SAS server running; are you using SAS CONNECT, Enterprise Guide, etc.?

fri0
Quartz | Level 8

I've asked for the path of the servers.

Just in case, I'm running on a SAS Server that is the same that SASMain. I use Enterprise Guide.

Reeza
Super User

Can you access SAS Foundation or Base SAS? It's easier there....

fri0
Quartz | Level 8

Hi Reeza, in the lower part, I suppose is the status bar or something like that appears: "

, connected to PAMLP01:8561/Foundation". Also, when you check the SASMain properties, PALMP01 appears as the host name (SASMain is the server from where I want to copy the table).

ChrisHemedinger
Community Manager

If you are using SAS Enterprise Guide, you can use Data->Download SAS Data Sets and then Data->Upload SAS Data Sets to copy the data from your source library to your PC, then from your PC to your target library.  That is two hops, but the file transfer is pretty fast as long as you have a good network connection.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
sasprofile
Quartz | Level 8

Hi Chris

am trying to move tables from one libarary to another library in SAS 9.2 (solaris 5.10)

How can i do that,please can you give the steps

I would really appreciate for all your help

Thank you

ChrisHemedinger
Community Manager

If both of your SAS libraries are on the same SAS session, you can use PROC COPY or PROC DATASETS with the COPY statement.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
sasprofile
Quartz | Level 8

both are in same sas session i tried this but its not moving any tables

here QOC11 and POC12 are my two libaries
and qoc and tlib12 are librefs

I tried to move one table AVG_DIFFS_FROM_TARGETS shown below

LIBNAME qoc 'QOC11';

LIBNAME tlib12 'POC12';

PROC COPY;

COPY IN=qoc OUT=tlib12 MOVE;

SELECT AVG_DIFFS_FROM_TARGETS;

RUN;

Reeza
Super User

You don't need librefs for libraries. Put the library names directly into proc copy or datasets.

PROC datasets library=work nodetails nolist;

COPY IN=QOC12 OUT=POC12;

SELECT AVG_DIFFS_FROM_TARGETS;

RUN; QUIT;

sasprofile
Quartz | Level 8

Reeza,

Thanks alot for your prompt reply

I got below error when i ran the above

COPY IN=QOC12 OUT=Testlib;

         __

         22

         76

                       

NOTE: Enter RUN; to continue or QUIT; to end the procedure.

ERROR 22-322: Syntax error, expecting one of the following: ;, ALTER, CLONE, CONSTRAINT, DATECOPY, FORCE, IN, INDD, INDEX, INLIB,

              MEMTYPE, MOVE, MT, MTYPE, NOCLONE, OUT, OUTDD, OUTLIB, PROTECT, PW. 

ERROR 76-322: Syntax error, statement will be ignored.

Reeza
Super User

Your proc copy is incorrect, the in/out are on the same line as proc copy. Or use proc datasets.

Both of the ones below work.

Also, in the future please ask a new question rather than post in a question that is 2 years old.

libname test '/folders/myfolders';

proc copy library=work;

copy out=test in=sashelp;

select class cars heart;

run;quit;

proc copy out=test in=sashelp;

select air;

run;quit;

LinusH
Tourmaline | Level 20

Copying data between servers, and especially to a specific work-library, doesn't sound like a best practice.

If this is one time shot, just copy in a windows explorer, or whatever tool that is available to you.

What will you do with the table in the other work? Are you using EG in both these servers? Can't get the full picture here...

Data never sleeps

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 12 replies
  • 19722 views
  • 0 likes
  • 6 in conversation