Hello All,
How do I FTP a file from one directory to other within SAS in UNIX?
FTP needs to be done only if I have an error free log.
Thanks,
proc copy and proc datasets don't work for moving files in UNIX?
The files I create are to be sftp'd to HADOOP process.So I cannot Sftp sas datasets.I need to sftp a delimited file created from SAS datasets.
Hi,
I am curious why you never mark your questions as answered? No one has provided you with a correct answer so far?
I usually reply saying thanks for by Liking their response.
SASPhile,
Liking is nice, but checking a response to a question as answered has several advantages
-- the respondent gets "credit" in the forum for their expertise
-- we readers get to see the answer adjacent to the original question, so it is easier to follow (some of the thread get very long).
-- an icon is marked next to the thread that it has been answered. That helps those with limited time to use it most productively.
Hope that helps,
Doc
Where to check a response as answered?
Have you tried the filename statement with ftp access method? Here's doc, SAS(R) 9.3 Statements: Reference and example.
This example reads the file ftpmem1
from a directory on a UNIX host, and writes the file ftpout1
to a different directory on another UNIX host.
filename indir ftp '/usr/proj2/dir1' DIR host="host1.mycompany.com"
user="xxxx" prompt; filename outdir ftp '/usr/proj2/dir2' DIR FILEEXT
host="host2.mycompany.com" user="xxxx" prompt;
data _null_; infile indir(ftpmem1) truncover; input; file outdir(ftpout1); put _infile_; run;
The file ftpout1
is written to /usr/proj2/dir2/ftpout1.DATA
. Note that a member type of DATA is appended to the ftpout1
file because the FILEEXT option was specified in the output file's FILENAME statement.
Note: The DIR option is not needed for some ODS destinations.
The following example writes an output file and transfers it to an ODS-specified destination. The DIR option is not needed.
filename output ftp "~user/ftpdir/"
host="host.fyi.company.com" user="userid" pass="userpass"
recfm=s debug;
ods html body='body.html' path=output; proc print data=sashelp.class;run;
To export multiple graph files to a remote directory location, the DIR option must be specified in the FILENAME statement. Accordingly, when creating external graph files with the ODS HTML destination, two FILENAME statements are needed: one for the HTML files, and one for the graph files. The following example illustrates the need for two FILENAME statements.
filename output1 ftp "~user/dir" fileext
host="host.unx.company.com" user="userid" pass="userpass"
recfm=s debug; filename output2 ftp "~user/dir" dir fileext
host="host.unx.company.com" user="userid" pass="userpass"
recfm=s debug; ods html body='body.html'
path=output1 gpath=output2 frame='frames.html' contents='contents.html';
proc gtestit; run; quit; ;
Use PROC HADOOP and avoid the FTP stuff...
http://support.sas.com/documentation/cdl/en/achadoop/65227/PDF/default/achadoop.pdf
sample_config.xml
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://xxx.us.company.com:8020</value>
</property>
<property>
<name>mapred.job.tracker</name>
<value>xxx.us.company.com:8021</value>
</property>
</configuration>
filename cfg "C:\Users\sasabc\hadoop\sample_config.xml";
proc hadoop options=cfg username="sasabc" password="sasabc" verbose;
hdfs copyfromlocal="C:\user\sasabc\testdata.txt"
out="/users/sasabc/Hadoop/testdata.txt" overwrite;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.