- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
here i am trying to copy a .txt file from one server to another ftp server.But when I copy the file, I am getting the records in each new line.But i want the records to be in the same line upto the line size of 1024 as they were in the original file.
I have attached the original(before_copy.txt) and copied file(after_copy.txt),which is same before_copy.txt after getting copied to ftp site.I have renamed it for your reference.
the code which i have used to copy the file is as follows:-
filename indir '/Shared/ABC/';
filename outdir ftp dir host='****'
user='***' pass="***" ;
data _null_;
infile indir(before_copy.txt) lrecl=1024 ;
input;
file outdir(before_copy.txt) lrecl=1024 ;
put _infile_;
run;
Kinly let me know which option i need to use to copy the file as it was in the original one.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The files look to be in UNIX format (no CR/LF, only LF as line separator). But before_copy has 2 '0D'x characters, which are considered unwanted artifacts in UNIX text files and get stripped out by the FTP engine(s), most probably not SAS. You also have one empty line (2 '0A'x in succession) where SAS probably skips the line (missover default option).
Bottom line: if you need an _exact_ copy, use command line ftp/sftp and specify binary mode.
Or try the recfm=n option in SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The files look to be in UNIX format (no CR/LF, only LF as line separator). But before_copy has 2 '0D'x characters, which are considered unwanted artifacts in UNIX text files and get stripped out by the FTP engine(s), most probably not SAS. You also have one empty line (2 '0A'x in succession) where SAS probably skips the line (missover default option).
Bottom line: if you need an _exact_ copy, use command line ftp/sftp and specify binary mode.
Or try the recfm=n option in SAS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi from sas we can COPY, PASTE, CUT and DELETE the raw datafiles using X - Statement
Ex:- X 'COPY "Path exist folder\test.txt" "Defined folder\out.txt"';
X MOVE "Path exist folder\test.txt" "Defined folder\out.txt"';
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
have a look at this blog entry Copy a file using a SAS program: another method - The SAS Dummy by Chris Hemedinger