DATA Step, Macro, Functions and more

filename ftp list with proxy server

Reply
Contributor
Posts: 29

filename ftp list with proxy server

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.

Super User
Posts: 6,927

Re: filename ftp list with proxy server

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 29

Re: filename ftp list with proxy server

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

Super User
Posts: 6,927

Re: filename ftp list with proxy server

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

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 29

Re: filename ftp list with proxy server

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

Ask a Question
Discussion stats
  • 4 replies
  • 369 views
  • 0 likes
  • 2 in conversation