BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ebowen
Quartz | Level 8

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.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

3 REPLIES 3
ballardw
Super User

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.

 

ebowen
Quartz | Level 8

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.

ballardw
Super User

@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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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