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!
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.?
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.?
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.
Can you access SAS Foundation or Base SAS? It's easier there....
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).
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
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
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
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;
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;
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.
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;
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...
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.