- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hello .. i need to create the following layout ..
i would appreciate a solution on how to export append to an existing .txt file
thanks in advance
Gerda
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please provide more context on what you are actually doing.
But the answer is the MOD option on the FILE statement. It looks like your example photograph has three types of records. So write them with three data steps. The first one excludes the MOD option and will remove any existing file and start a new one. The others use the MOD option and append to the existing file.
data _null_;
file 'myfile.txt' dsd dlm='|';
set have1;
put (_all_) (+0);
run;
data _null_;
file 'myfile.txt' dsd dlm='|' mod;
set have2;
put (_all_) (+0);
run;
data _null_;
file 'myfile.txt' dsd dlm='|' mod;
set have3;
put (_all_) (+0);
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think this will help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How is the text file created in the first place?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please provide more context on what you are actually doing.
But the answer is the MOD option on the FILE statement. It looks like your example photograph has three types of records. So write them with three data steps. The first one excludes the MOD option and will remove any existing file and start a new one. The others use the MOD option and append to the existing file.
data _null_;
file 'myfile.txt' dsd dlm='|';
set have1;
put (_all_) (+0);
run;
data _null_;
file 'myfile.txt' dsd dlm='|' mod;
set have2;
put (_all_) (+0);
run;
data _null_;
file 'myfile.txt' dsd dlm='|' mod;
set have3;
put (_all_) (+0);
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am very grateful .. thank you!