Hello everyone,
I can use data _null_; file filename to update/overwrite an txt file
also I can use mod option to append to text file.here is the code:
filename old "c:\temp\test\old";
data _null_;
file old;
put 'this is row 1';
put 'this is row 2';
put 'this is row 3';
put 'this is row 4';
put 'this is row 5';
put 'this is row 6';
put 'this is row 7';
put 'this is row 8';
put 'this is row 9';
put 'this is row 10';
run;
data a;
new="I want row number 6 to be updated";
run;
data _null_;
set a;
file old mod ;
put new;
run;
the result of old is:
this is row 1 this is row 2 this is row 3 this is row 4 this is row 5 this is row 6 this is row 7 this is row 8 this is row 9 this is row 10 I want row number 6 to be updated
My question is I don't want string new append on the old file, I want the string new update the 6th row of old file.
the result should like this:
this is row 1 this is row 2 this is row 3 this is row 4 this is row 5 I want row number 6 to be updated this is row 7 this is row 8 this is row 9 this is row 10
Please help!
Thanks!
... View more