<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic My Program seems to run MOD on File Statements when MOD is not declared. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24049#M5398</link>
    <description>Here's my program:&lt;BR /&gt;
&lt;BR /&gt;
data _NULL_;&lt;BR /&gt;
  length testFile $20;&lt;BR /&gt;
  &lt;BR /&gt;
  testFile = "testFile0.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "THIS IS A TEST";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile1.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "This is a test";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile0.txt";&lt;BR /&gt;
  file out filevar=testFile MOD notitle noprint;&lt;BR /&gt;
  put "THIS IS A TEST";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile1.txt";&lt;BR /&gt;
  file out filevar=testFile MOD notitle noprint;&lt;BR /&gt;
  put "This is a test";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile0.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "THIS IS A TEST";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile1.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "This is a test";&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Here is the new file:  testFile0.txt:&lt;BR /&gt;
&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
&lt;BR /&gt;
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:&lt;BR /&gt;
&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
&lt;BR /&gt;
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).&lt;BR /&gt;
&lt;BR /&gt;
The MOST preferable output of this program would be for testFile0.txt to look like:&lt;BR /&gt;
&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
Thanks much!&lt;BR /&gt;
    -Jim</description>
    <pubDate>Tue, 18 May 2010 18:24:54 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-05-18T18:24:54Z</dc:date>
    <item>
      <title>My Program seems to run MOD on File Statements when MOD is not declared.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24049#M5398</link>
      <description>Here's my program:&lt;BR /&gt;
&lt;BR /&gt;
data _NULL_;&lt;BR /&gt;
  length testFile $20;&lt;BR /&gt;
  &lt;BR /&gt;
  testFile = "testFile0.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "THIS IS A TEST";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile1.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "This is a test";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile0.txt";&lt;BR /&gt;
  file out filevar=testFile MOD notitle noprint;&lt;BR /&gt;
  put "THIS IS A TEST";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile1.txt";&lt;BR /&gt;
  file out filevar=testFile MOD notitle noprint;&lt;BR /&gt;
  put "This is a test";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile0.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "THIS IS A TEST";&lt;BR /&gt;
&lt;BR /&gt;
  testFile = "testFile1.txt";&lt;BR /&gt;
  file out filevar=testFile notitle noprint;&lt;BR /&gt;
  put "This is a test";&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Here is the new file:  testFile0.txt:&lt;BR /&gt;
&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
&lt;BR /&gt;
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:&lt;BR /&gt;
&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
&lt;BR /&gt;
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).&lt;BR /&gt;
&lt;BR /&gt;
The MOST preferable output of this program would be for testFile0.txt to look like:&lt;BR /&gt;
&lt;BR /&gt;
THIS IS A TEST&lt;BR /&gt;
&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
Thanks much!&lt;BR /&gt;
    -Jim</description>
      <pubDate>Tue, 18 May 2010 18:24:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24049#M5398</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-18T18:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: My Program seems to run MOD on File Statements when MOD is not declared.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24050#M5399</link>
      <description>You can achieve the desired result using another name as the fileref.  The FILE statement has parts that are compiled and other parts that are executable DISPOSITION is compiled so when MOD is specified it applies to all file statements with the same name OUT.  You will need to release the last file referenced with OUTOLD as shown below.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _NULL_;&lt;BR /&gt;
length testFile $20;&lt;BR /&gt;
&lt;BR /&gt;
testFile = "testFile0.txt";&lt;BR /&gt;
file &lt;B&gt;outold&lt;/B&gt; filevar=testFile notitle noprint;&lt;BR /&gt;
put "THIS IS A TEST 1";&lt;BR /&gt;
&lt;BR /&gt;
testFile = "testFile1.txt";&lt;BR /&gt;
file &lt;B&gt;outold&lt;/B&gt; filevar=testFile notitle noprint;&lt;BR /&gt;
put "This is a test 1";&lt;BR /&gt;
&lt;BR /&gt;
&lt;I&gt;&lt;B&gt;testfile = 'dummy';&lt;BR /&gt;
file outold filevar=testfile;&lt;/B&gt;&lt;/I&gt;&lt;BR /&gt;
testFile = "testFile0.txt";&lt;BR /&gt;
file out filevar=testFile MOD notitle noprint;&lt;BR /&gt;
put "THIS IS A TEST 2";&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
testFile = "testFile1.txt";&lt;BR /&gt;
file out filevar=testFile MOD notitle noprint;&lt;BR /&gt;
put "This is a test 2";&lt;BR /&gt;
&lt;BR /&gt;
testFile = "testFile0.txt";&lt;BR /&gt;
file out filevar=testFile notitle noprint;&lt;BR /&gt;
put "THIS IS A TEST 3";&lt;BR /&gt;
&lt;BR /&gt;
testFile = "testFile1.txt";&lt;BR /&gt;
file out filevar=testFile notitle noprint;&lt;BR /&gt;
put "This is a test 3";&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]

Message was edited by: data _null_;</description>
      <pubDate>Tue, 18 May 2010 21:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24050#M5399</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-05-18T21:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: My Program seems to run MOD on File Statements when MOD is not declared.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24051#M5400</link>
      <description>Hey data _null_;,&lt;BR /&gt;
    That worked perfectly!  Thank you for the great advice.  It was exactly what I needed to know &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;BR /&gt;
    -Jim</description>
      <pubDate>Wed, 19 May 2010 15:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/My-Program-seems-to-run-MOD-on-File-Statements-when-MOD-is-not/m-p/24051#M5400</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-19T15:40:33Z</dc:date>
    </item>
  </channel>
</rss>

