Architecting, installing and maintaining your SAS environment

How to Download/Import/Get a File From Server to Local PC

Accepted Solution Solved
Reply
Super Contributor
Posts: 381
Accepted Solution

How to Download/Import/Get a File From Server to Local PC

Hello everyone,

 

I have a sample report as below. My purpose is to download the xml or xlsx file in my local PC from the server. I found Chris Hemedinger’s blog post on the internet but I couldn’t find the “Copy Files” task on Enterprise Guide 5.1 and he also showed for “Proc Export” procedure, I’m not sure whether “ods tagsets.ExcelXP” will work or not. I export the xml file as the following path on the server. “sas9/sasdata/....../Example.xml”. I can see the file on Enterprise Guide but I can’t open or copy to my Local PC from the server. I'd like to state that I have to use the “ods tagsets.ExcelXP”.

 

Chris Hemedinger’s post : http://blogs.sas.com/content/sasdummy/2013/05/20/export-and-download-any-file-from-sas-enterprise-gu...

 

ods html(id=1) file='server path' style=htmlblue
    options(page_break='no');
ods msoffice2k(id=2) file='server path' style=htmlblue
    options(page_break='no');
ods tagsets.excelxp(id=3) file='server path' style=htmlblue
    options(embedded_titles='no' sheet_interval='none' sheet_name='AllGroups');
ods excel(id=4) file='server path' style=htmlblue
    options(embedded_titles='no' sheet_interval='none' sheet_name='AllGroups');
proc sort data=sashelp.shoes out=shoes;
  by region subsidiary product;
  where product in ('Sandal' 'Boot' 'Slipper') and
        region in ('Asia', 'Pacific', 'Canada');
run;
** starting program;
proc report data=shoes 
     style(summary) = Header;
title '1) Without extra columns';
where product in ('Sandal' 'Boot' 'Slipper');
  column region subsidiary product,(sales returns calc);
  define region /group;
  define subsidiary / group;
  define product / across;
  define sales /sum f=dollar12.;
  define returns / sum f=dollar12.;
  define calc / computed f=dollar12.;
  break after region / summarize;
  compute after region;
     region = 'Sum';
	 line ' ';
  endcomp;
  compute calc;
     _c5_ = _c3_ - _c4_;
	 _c8_ = _c6_ - _c7_;
	 _c11_ = _c9_ - _c10_;
  endcomp;
run;
ods html(id=1) close;
ods msoffice2k(id=2) close;
ods tagsets.excelxp(id=3) close;
ods excel(id=4) close;
title;
options byline;

Thank you.


Accepted Solutions
Solution
‎06-03-2016 03:52 AM
Community Manager
Posts: 2,772

Re: How to Download/Import/Get a File From Server to Local PC

The custom task you need is linked from this blog post.  A few simple steps to download, copy to a special folder on your PC, and then EG can find the task.

View solution in original post


All Replies
Solution
‎06-03-2016 03:52 AM
Community Manager
Posts: 2,772

Re: How to Download/Import/Get a File From Server to Local PC

The custom task you need is linked from this blog post.  A few simple steps to download, copy to a special folder on your PC, and then EG can find the task.

Super User
Posts: 6,972

Re: How to Download/Import/Get a File From Server to Local PC

You can also try a file transfer program like WinSCP.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 381

Re: How to Download/Import/Get a File From Server to Local PC

Unfortunately, I cannot use WinSCP, MobAxterm,Fillazilla, etc. because I'm working on customer place as an end user. They don't let us.

 

I tried to do 

Super User
Posts: 3,115

Re: How to Download/Import/Get a File From Server to Local PC

What about FTP? That command is part of Windows and Unix operating systems so you don't need to install anything. Its not as friendly as @ChrisHemedinger's solution though.

Super Contributor
Posts: 381

Re: How to Download/Import/Get a File From Server to Local PC

Do you mean FTP code in SAS like following link?

 

http://support.sas.com/kb/43/962.html 

 

Can I pull the file by using SAS code?

 

Thanks

 

 

 

Super User
Posts: 3,115

Re: How to Download/Import/Get a File From Server to Local PC

To use FTP in SAS code you would need to be able to FTP from your SAS server to your PC. You need to find out the IP address or host name of your PC as the first step. 

Community Manager
Posts: 2,772

Re: How to Download/Import/Get a File From Server to Local PC

Then, as a next step, you would need to be able to enable/start an FTP server on your local PC.  That's an unusual thing to do on most workstations -- and might not be permitted in a tightly controlled IT environment.

 

Not that I'm rooting for my own answer here (and the Copy Files task), but I know that if you decide to go with that, you'll be in good company.  Hundreds of other users now rely on that task -- and probably many more that I haven't heard from...

Super Contributor
Posts: 381

Re: How to Download/Import/Get a File From Server to Local PC

Okay, Mr. Hemedinger,

 

I'm agree with you, your method is best solution according to current circumstances.

 

Thank you very much Smiley Happy

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 561 views
  • 6 likes
  • 4 in conversation