Thank you Chris.
Does this code work to read an excel file from SFTP? It works when I run it to copy excel files locally but when the source filename is from SFTP, the file comes corrupted from the SFTP server with following message. "The file format or file extension is invalid."

Here is my code.

filename in sftp 'abc.xlsx' host="hostname" user="test" CD="&SFTPPath." options="-P 5555-i D:\PrivateKey.ppk -pw test" ;
filename out "D:\test\abc.xlsx";

/* copy the file byte-for-byte */
data _null_;
length filein 8 fileid 8;
filein = fopen('in','I',1,'B');
fileid = fopen('out','O',1,'B');
rec = '20'x;
do while(fread(filein)=0);
rc = fget(filein,rec,1);
rc = fput(fileid, rec);

rc =fwrite(fileid);
end;
rc = fclose(filein);
rc = fclose(fileid);
run;

filename in clear;
filename out clear;

RUN;