LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 15 Jul 2009 10:00:56 -0700
Reply-To:     "DUELL, BOB (ATTCINW)" <BD9439@ATT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "DUELL, BOB (ATTCINW)" <BD9439@ATT.COM>
Subject:      Re: Any method to download a file from the web ?
Comments: To: Tom Quin <tomquin99@GMAIL.COM>
In-Reply-To:  A<1e68272c0907131441g5841a041ua82a2b3c0a053035@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"

Hi Tom,

Although I'm sure you can figure out a way to do this with plain old SAS, I'd suggest you use an external utility to fetch the file from your web site. I use an Open Source utility called wget for similar work. Once installed on your computer, it's easy to call it from a SAS program.

The main page for wget is here: http://www.gnu.org/software/wget/

Wget is available for several operating system. Since it looks like you are using Windows, here is a SourceForge link:

http://gnuwin32.sourceforge.net/packages/wget.htm

Hope this helps, and good luck,

Bob

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom Quin Sent: Monday, July 13, 2009 2:42 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Any method to download a file from the web ?

Thanks, Mark.

In the code of FOR TEXT , we read a record from the web file and output it. So there is no problem.

For the code FOR BINARY, I made two tests with urls found from google.

* The code works well for this url but the generated mydata.zip is a bad one; it can not be opened.; filename myurl url ' http://www.surface.mat.ethz.ch/research/surface_forces/extended_SFA/inst rumental_drift_SFA/downlaod_software/SEPC.ZIP '; filename myfile 'c:/temp/mydata.zip'; data _null_; infile myurl recfm=n; input; file myfile; put _infile_; run; * This url is also good but the code generated error; filename myurl url ' http://mis.nyiso.com/public/htm/damlbmp/20090701damlbmp_zone_htm.zip'; filename myfile 'c:/temp/mydata.zip'; data _null_; infile myurl recfm=n; input; file myfile; put _infile_; run;

NOTE: Unable to connect to host mis.nyiso.com. Check validity of host name. ERROR: Hostname mis.nyiso.com not found.

So I am still wondering if this filename url method is good for this task, or is there any other way...

Thanks.

On Mon, Jul 13, 2009 at 4:27 PM, Terjeson, Mark <Mterjeson@russell.com>wrote:

> Hi Tom, > > > untested -- will something like this get you close? > > > > * FOR BINARY? untested ; > > filename myurl url 'http://www.mywebsite.com/mydir/mydata.zip'; > filename myfile 'c:/temp/mydata.zip'; > > data _null_; > infile myurl recfm=n; > input; > file myfile; > put _infile_; > run; > > > > * FOR TEXT ; > > filename foo url > 'http://support.sas.com/techsup/service_intro.html'; > > data _null_; > infile foo length=len; > input record $varying200. len; > put record $varying200. len; > if _n_=15 then stop; > run; > > > > > > Hope this is helpful. > > > Mark Terjeson > Investment Business Intelligence > Investment Management & Research > Russell Investments > 253-439-2367 > > > Russell > Global Leaders in Multi-Manager Investing > > > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom > Smith > Sent: Monday, July 13, 2009 1:15 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Any method to download a file from the web ? > > I am wondering if there is a way in SAS to download a file from a > website. > For example, to download the file > http://www.mywebsite.com/mydir/mydata.zip > and save it to my PC. > > Please note, it is not to read data directrly from the web using > Filename > URL method. (but if this method can download the data, it is also > welcome.) > > Thanks a lot. >


Back to: Top of message | Previous page | Main SAS-L page