BookmarkSubscribeRSS Feed
benparado
Calcite | Level 5

Hi guys,

 

My team currently have a script to copy output files from SAS windows server (using SAS Enterprise Guide) to a LAN shared network folder. Below is the code that we used to copy all the files from a SAS folder to our office LAN shared folder.

%sysExec xcopy "M:\BAU\output_files\*.*" "\\w01g1bnkfps02x\disk_vol2\RSAN\BAU" /E;

 

However, our office is trying to decommissioned all LAN folders and we are forced to migrate to an Office 365 Sharepoint. I tried replacing the target path to the UNC path of our O365 sharepoint as below. (Note: Our SAS server admin mentioned that the Web Client Services in the SAS server is installed and enabled.)

%sysExec xcopy "M:\BAU\output_files\*.*"
"\\myofc.sharepoint.com@SSL\DavWWWRoot\sites\DISK_VOL2\Doc\RSAN\BAU" /E;

After executing there were no files copied in the sharepoint folder. I tried a simple export to check if I can copy 1 file in the Sharepoint folder. However I got an error "ERROR: Physical file does not exist, \\myofc.sharepoint.com@SSL\DavWWWRoot\sites\DISK_VOL2\Doc\RSAN\BAU\file1.csv."

libname mylib "M:\BAU\output_files";
proc export data=mylib.file1
outfile="\\myofc.sharepoint.com@SSL\DavWWWRoot\sites\DISK_VOL2\Doc\RSAN\BAU\file1.csv"
DBMS=CSV replace;
run;

I also tried using the filename webdav code I found in a SAS documentation site, but it returned me an error "ERROR: No logical assign for filename WRITEIT. ERROR: Error in the FILENAME statement."

options set=sharepoint_comp_mode 1;
filename writeit webdav
   "https://myofc.sharepoint.com/sites/DISK_VOL2/Doc/RSAN/BAU/"
    dir user="<my ofc email addy>" pass=<password>;
    data _null_;
       file writeit(shoes);
       set sashelp.shoes;
       put region $25. product $14.;
    run;

Is there other way we can transfer files from a SAS window-based server to an Office 365 sharepoint? Our team's issue is the output files we generate every month is quite a lot and if we copy the files manually from SAS server to a local computer and from local computer to the Sharepoint folder, it will take a lot of time and effort to do it. 

 

Thanks in advance for any help, suggestion and advice.

 

Regards,

Ben

1 REPLY 1
Kurt_Bremser
Super User

Before using a system command from SAS, make sure that it performs correctly by running it from the commandline. Once that is made sure of, run it from SAS.

If you can't get a commandline interface on the server, use this in SAS to get all system output into the SAS log:

filename oscmd pipe "command 2>&1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

This can give you a clue what's going wrong.

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!

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
  • 1 reply
  • 1311 views
  • 0 likes
  • 2 in conversation