Help using Base SAS procedures

Error when downloading zip file using PROC HTTP

Accepted Solution Solved
Reply
Contributor
Posts: 32
Accepted Solution

Error when downloading zip file using PROC HTTP

For quite a while, I have been using PROC HTTP to download a zip file from a web site so I can access it using the filename zip statement. But recently I have been getting an error message in my log:

 

ERROR: Connection has been closed

 

My code is as follows:

proc http
 method='GET'
 url="https://arlweb.msha.gov/OpenGovernmentData/DataSets/MinesProdQuarterly.zip"
 out=prodtmp;
run;

Here, prodtmp is a filename path where I want to download it. I'm using SAS 9.4M4. Any help you can provide would be much appreciated! Thanks.


Accepted Solutions
Solution
‎01-23-2018 10:19 AM
Super User
Posts: 13,583

Re: Error when downloading zip file using PROC HTTP

The error message, connection closed, is almost certainly not a SAS issue but a web connectivity issue such as bandwidth or the website is busy or undergoing maintenance that restricts users from accessing files.

 

Since the apparent size of the file is 28M you might also get this if the download is just taking too long because of temporary network conditions.

 

Try again. Or if you have something time critical you might attempt to download the file manually and then use the local file.

 

View solution in original post


All Replies
Solution
‎01-23-2018 10:19 AM
Super User
Posts: 13,583

Re: Error when downloading zip file using PROC HTTP

The error message, connection closed, is almost certainly not a SAS issue but a web connectivity issue such as bandwidth or the website is busy or undergoing maintenance that restricts users from accessing files.

 

Since the apparent size of the file is 28M you might also get this if the download is just taking too long because of temporary network conditions.

 

Try again. Or if you have something time critical you might attempt to download the file manually and then use the local file.

 

Contributor
Posts: 32

Re: Error when downloading zip file using PROC HTTP

[ Edited ]

Thanks for your answer. I did go ahead and download the file outside of SAS. I've tried it several more times since then, and I'm still unable to download the file through PROC HTTP. It seems to go for about 2 minutes and then time out. I can't see why there would be a bandwidth problem as I can download it through my browser in about 30 seconds. Anyway, I have a workaround and I'll keep trying it.

Super User
Posts: 13,583

Re: Error when downloading zip file using PROC HTTP


ebowen wrote:

Thanks for your answer. I did go ahead and download the file outside of SAS. I've tried it several more times since then, and I'm still unable to download the file through PROC HTTP. It seems to go for about 2 minutes and then time out. I can't see why there would be a bandwidth problem as I can download it through my browser in about 30 seconds. Anyway, I have a workaround and I'll keep trying it.


I don't really know the internals of Proc Http but most of the browser downloads have built-in adjustments to handle short breaks in accessibility. If you've ever had a download that started off with an "estimated time to completion" or similar that jumps from 10 minutes to 45 minutes that is because it has seen a change in the network throughput and is adjusting. I might guess that either the Proc HTTP doesn't have as robust a fall back or that the connection type it establishes to the server is one that the server terminates under some condition.

☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 140 views
  • 0 likes
  • 2 in conversation