Wanted some help understanding use of ftp within a SAS program to transfer files from one machine to another. Right now I am trying to transfer from a windows machine to another windows machine which is a ftp server
Say I have a file C:\Folder1\test.txt on machine A and want to transfer this file to folder
B on the FTP server machine, can anybody point to what the syntax will be like.
The "remote" FTP server must be configured for access on one or more volumes - normally one as I recall. You may be able to accommodate the rqmt within the FTP server configuration, however it would not be a drive-letter technique. Check with your FTP server admin, possibly a sub-domain maybe?
For the above to work, file sasProg1.txt has to be created on the remote machine before executing the program. Else it complains no physical file existing.
My question is how do I create file(and also folders) on the remote machine?
I want to create some specific folder structure during runtime and then write the files in appropriate folder on the remote machine.
FIrst, you need to CLOSE the "ODS RTF" after the PROC PRINT. If you are still having errors with the FILENAME execution, reply with the COPY/PASTE info from your SAS execution log and provide specific error messages, along with the SAS log and the code being executed.
Then, if you need to create a remote server directory, you will need review the appropriate SAS companion guide and explore using the FILENAME PIPE engine to execute remote system commands. I have pasted the related UNIX companion guide - there is one for each supported platform, available at the SAS support http://support.sas.com/ website for reference and use.
I don't know how it is supposed to behave. I thought it is expecting the sasProg1.txt to exist locally in the current directory. So I created dummy file with name sasProg1.txt
in current directory where the SAS program is, Still it complained about physical file not existing. When I created the file sasProg1.txt on remote machine it works and writes the contents from proc print to it.
I didn't know the FTP filename engine could be used for ODS output, though you seem to have succeeded.
You can use the FTP filename in a data step to either:
- create an empty remote file and use the ODS to FTP output in post 1, like:
filename myftp ftp 'sasProg1.txt' ...;
data _null_; *create empty file before output;
put ' ';
ods rtf file=myftp;
[.. create file ..]
- transfer the file you have created locally in the post above, like:
[.. create file ..]
ods listing close;