BookmarkSubscribeRSS Feed
niemannk
Calcite | Level 5
filename ftpdir ftp  ' ' list 
				user='username@ftp.server.com'
				pass='topsecret' 
				host='our.proxy.server'
				port=8080
				cd='download/' PASSIVE debug;

data ftp_dir (drop=str: hh) ;
   infile ftpdir dsd dlmstr=' '  MISSOVER;
   informat strDate $8.  strtime $7.   bytes 8.  name $50. ; 
   input  strDate   strtime  bytes name ;
   format Datetime datetime20. hh 2.  date ddmmyy8.;
		date=MDY(substr(strDate,1,2)*1,substr(strDate,4,2)*1,substr(strDate,7,2)*1);
	 if substr(strtime,6,2)='PM' then hh=substr(strtime,1,2)+12; else hh=substr(strtime,1,2)*1;
	Datetime=DHMS(	  date
					, hh
					, substr(strtime,4,2),0);
run;

SAS takes this filename statement, but then the datastep end with a critical error:

 

ERROR:  An exception has been encountered.
Please contact technical support and provide them with the following
       traceback information:

The SAS task name is [DATASTEP]
ERROR:  Read Access Violation DATASTEP
Exception occurred at (09264F14)
Task Traceback
Address   Frame     (DBGHELP API Version 4.0 rev 5)
0000000009264F14  000000000B82F120  sasdsx:tkvercn1+0x23ED4

I tried to take the passive parameter out, but same error. It just doesn't want to read the ftp directory. I am absolutley clueless.

4 REPLIES 4
Kurt_Bremser
Super User

filename ftp is for direct connections to the ftp server port, it does not supply the necessary information that tells the "everything"-proxy which protocol is being used. By default the proxy expects http.

You may have to have the ftp port opened on the firewall for outgoing connections. Then you will also need the passive option.

niemannk
Calcite | Level 5

not sure if I understand it correctly, but I would conclude that it simply will not work...

Kurt_Bremser
Super User

After further research, I think your method should work, but it can only work if your proxy is also a FTP proxy.

To test this, start Windows ftp (without parameters).

Enter the following:

open our.proxy.server 8080

username@ftp.server.com (when prompted for username)

topsecret (when prompted for password)

if you don't get a connection, your proxy probably doesn't support FTP connections

 

If that works, open a track with SAS Technical Support, as you may have a SAS-internal problem

niemannk
Calcite | Level 5

nothing works. I think it is the proxy server that doesn't know ftp. However using powershell I can use the Webclient Object & Method "downloadFile".

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 4277 views
  • 0 likes
  • 2 in conversation