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
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;
I think this will help you
How is the text file created in the first place?
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;
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.