Here's my program:
data _NULL_;
length testFile $20;
testFile = "testFile0.txt";
file out filevar=testFile notitle noprint;
put "THIS IS A TEST";
testFile = "testFile1.txt";
file out filevar=testFile notitle noprint;
put "This is a test";
testFile = "testFile0.txt";
file out filevar=testFile MOD notitle noprint;
put "THIS IS A TEST";
testFile = "testFile1.txt";
file out filevar=testFile MOD notitle noprint;
put "This is a test";
testFile = "testFile0.txt";
file out filevar=testFile notitle noprint;
put "THIS IS A TEST";
testFile = "testFile1.txt";
file out filevar=testFile notitle noprint;
put "This is a test";
run;
Here is the new file: testFile0.txt:
THIS IS A TEST
THIS IS A TEST
THIS IS A TEST
Here is testFile0.txt again, after a second run of the same SAS program, when I haven't deleted testFile0.txt from the previous run, and I have completely restarted the SAS program:
THIS IS A TEST
THIS IS A TEST
THIS IS A TEST
THIS IS A TEST
THIS IS A TEST
THIS IS A TEST
I would prefer that testFile0.txt be rebuilt from scratch, not Modded every time (otherwise the first FILE statement would have contained a MOD, as would the third).
The MOST preferable output of this program would be for testFile0.txt to look like:
THIS IS A TEST
since I didn't declare MOD on the third statement. Anyone know how I can get SAS to follow this functionality since it seems to be assuming MOD on every file statement? I tried OLD on the non-MOD statements, but that seemed to have no affect whatsoever on the output.
Thanks much!
-Jim