SAS Support
Self Service Support
Assisted Support
Premium Support
Enterprise Support
Logging a Call
Service Levels
Hints and Tips
 

HOW CAN I READ A TEXT FILE FROM A REMOTE HOST INTO A LOCAL SAS SESSION USING THE FTP PROTOCOL?

SAS modules addressed: Base, Data Step/SQL, Data Access

The filename FTP access method allows you to access remote files using the FTP protocol from FTP servers.

In the example below the file test.txt has been accessed using FTP and read into a local SAS dataset test.

filename myfile ftp 'test.txt' cd='/unix/directory/specification'
  host='Network.Name.Remote.Host'
user='Username'
pass='Password'
recfm=v ;
data work.test ;
   length var1 $ 200 ;
    infile myfile ;
   input var1 ;
   put _infile_ ;
run;
 

Here we are creating a text file called test2.txt on a remote Unix host using FTP.

filename create ftp 'test2.txt' cd='/unix/directory/specification'
  host='Network.Name.Remote.Host'
user='Username'
pass='Password'
recfm=v ;
data _null_ ;
   file create ;
   do i=1 to 10 ;
      put i= ;
   end ;
run ;
 

Note: The above code has been tested using SAS 8.2 on the Windows operating system.

Did you find this page useful?

If you have any comments or questions, feel free to contact us.



0845 402 9907