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

Hi,

 

I'm using the method below to move text file sas server to ftp server. It ony takes 3 minute when i use ftp method in shell, but it takes 2 hour to move it with sas method.

 

I think it occurs because sas open txt file and move line by line. And file size almost 2 gb..

 

How i move txt file as batch and save time in ftp method?

 

Thanks.

 

sas method:

%macro ftp_data(sasData);
filename server ftp "/ftp/directory/&sasData..TXT" host="XX.XXX.X.XX"
user="user" pass="pass" ;
data _null_;
infile "/work/&sasData..TXT" recfm=n ;
input x $char1. @@;
file server recfm=s ;
put x $char1. @@;
run;

 

ftp method:

/usr/bin/ftp -inv <<!
open $FTP_HOST_NAME
passive
user $FTP_LOGIN $FTP_PASSWORD
cd ftp01/directory/
put $file
quit

 

1 ACCEPTED SOLUTION

Accepted Solutions
error_prone
Barite | Level 11
You already found the best solution: don't use sas code, but bash/cmd to transfer files. If you can execute os-commands in your sas-session, you can invoke cmd with the ftp-conmand directly. See the docs of X command.

View solution in original post

2 REPLIES 2
error_prone
Barite | Level 11
You already found the best solution: don't use sas code, but bash/cmd to transfer files. If you can execute os-commands in your sas-session, you can invoke cmd with the ftp-conmand directly. See the docs of X command.
Kurt_Bremser
Super User

Why are you transmitting a TEXT file as binary, byte-by-byte? Text files should be handled line-by-line.

No miracle that your SAS FTP is taking forever.

 

Although I concur that copying non-SAS data to non-SAS data is handled best from the commandline, if you need it controlled from SAS, use the filename pipe method to call the external command.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1724 views
  • 1 like
  • 3 in conversation