BookmarkSubscribeRSS Feed
OS2Rules
Obsidian | Level 7

Hi All:

I have an interesting problem and I don't even know whether it is possible to do.

I would like to test the connection speed to a remote server and I'm thinking that the best way to do this is to FTP.  If I upload and download a file using an FTP, can I capture the statistics as to how many bytes were transfered and how long it takes?  Quick calculation would give me a general idea of the connection speed.

My reasons for this are that we are planning to FTP to a client  files as part of a project and I would like to get some idea as to how long this process will take.  There are a large number of files of different sizes.  We currently have no idea whether the process will take 10 minutes or 10 hours. 

I would like to do the FTP connection test with SAS because we will be using SAS to send and reveive the files in the future.

Thanks in advance.

3 REPLIES 3
FriedEgg
SAS Employee

If you have unix you could use lftp and dd

filename tmp temp;

%let tmp=%sysfunc(pathname(tmp));

filename tmp clear;

filename ftp_test pipe "lftp site -u user,pass -c 'cat /path/to/file.txt' | dd of=&tmp";

filename in "&tmp";

data _null_;

infile ftp_test firstobs=3;

input @;

put _infile_;

run;

data ftp_file;

  infile in;

  input yada_yada $;

run;

I beleieve the Filename statement for FTP access from SAS follows a similar pattern, ie. the file is read from FTP to disk as a temp file, then read from temp file into DATA step.  I could be wrong about this, but if so this spends an extra I/O cycles doing so but will give you the speed at which the file is read from the FTP and written to local disk.  You could also pipe the file from the FTP the same way and append the information from dd to the last three lines of the incoming file instead, just remove the of= part of the command in the pipe.

Ksharp
Super User

Why don't you use PING command + '>' to re-direct  the result into a file and see the ping value.

I think it is better way.

Ksharp

OS2Rules
Obsidian | Level 7

Thanks to everyone who took time to think about this.

Unfortunately, I am not running Unix so I can't use any processes native to that system.

Also - a PING will not tell me the time it takes to upload or download a file.  I am already running a program that records the ping times.

From my experiments last night, here is what I came up with...

Firstly, I ran a PROC PRIINTTO to redirect the LOG file to a permanent dataset.  Then I created a macro program that executes the FILENAME myfile FTP etc. (with the DEBUG option) and reads the file.  The results from this are saved in the permanent log file. 

I can then use a macro %do statement to run the program with a SLEEP(nn) between each iteration.  I can sit back and let this program run for a while unattended.

Now I just need to write a little program to extract the data from the log file.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 3 replies
  • 1457 views
  • 0 likes
  • 3 in conversation