BookmarkSubscribeRSS Feed
franz
Fluorite | Level 6

Hi,

I am testing the filename socket access type with the aim of transferring binary files between two SAS sessions, i.e. send a binary file from the client session, the server session should receive the file and make a copy on the server where it runs. The binary file to be transferred can have any length. I have found many examples that show how to send an ASCII file and how to transfer a SAS Dataset by serializing on the client and deserializing the data on the server, but the behaviour I am after would be similar to that of an ftp client sending a file to an ftp server.


What I am looking for is something like the code below which would work for any file.

On the server (i.e. on machine "server.com"):

filename srv socket ":5100" server;

data _null_;

infile srv;

input;

file "/srvpath/myCopiedBinaryFile.bin";

put _infile_;

run;

On the client

filename client socket "server.com:5100";

data _null_;

infile "/clipath/myOriginalBinaryFile.bin";

input; /*The input here should ideally read the whole file*/

file client;

put _infile_;

run;

There a options for file type (A or B) and fixed length, streaming and others, but I have not managed to make it work, I don't even know if it is at all possible.

Any ideas? Thanks!

1 REPLY 1
Daniel-Santos
Obsidian | Level 7

Hi.

 

If over a client/server SAS connection why not to use the proc download/upload procedure with the BINARY option?

 

More on download procedure here:

http://support.sas.com/documentation/cdl/en/connref/61908/HTML/default/viewer.htm#prcd.htm

 

Daniel Santos @ www.cgd.pt

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 743 views
  • 0 likes
  • 2 in conversation