<?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 Re: Filename Statement Issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103911#M21704</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks....This explains it to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 May 2012 12:01:55 GMT</pubDate>
    <dc:creator>JohnH</dc:creator>
    <dc:date>2012-05-07T12:01:55Z</dc:date>
    <item>
      <title>Filename Statement Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103908#M21701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Calibri;"&gt;Can you explain the following code’s behavior:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Calibri;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;FILENAME&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt; StatFile &lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: purple; font-family: 'Lucida Console';"&gt;'C:\TEMP\TestStatus.txt'&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 14pt; font-family: 'Lucida Console';"&gt;DATA&lt;/STRONG&gt; &lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;_NULL_&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 14pt; background: white; color: green; font-family: 'Lucida Console';"&gt;*rc = FILENAME( 'StatFile', 'C:\TEMP\TestStatus.txt');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;FILE&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt; StatFile;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;PUT&lt;/SPAN&gt; &lt;SPAN style="font-size: 14pt; background: white; color: purple; font-family: 'Lucida Console';"&gt;"This is a test"&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;PUT&lt;/SPAN&gt; &lt;SPAN style="font-size: 14pt; background: white; color: purple; font-family: 'Lucida Console';"&gt;"THIS IS LINE 2"&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 14pt; background: white; color: green; font-family: 'Lucida Console';"&gt;*FILENAME StatFile CLEAR;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 14pt; font-family: 'Lucida Console';"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;FILENAME&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt; StatFile &lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: blue; font-family: 'Lucida Console';"&gt;CLEAR&lt;/SPAN&gt;&lt;SPAN style="font-size: 14pt; background: white; color: black; font-family: 'Lucida Console';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Calibri;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Calibri;"&gt;If I enable either FILENAME statement within the DATA step, and disable the corresponding FILNAME statement outside of the step, the FILE statement will not recognize the fileref. Instead, the FILE statement will use the string to create statfile.dat in the current working directory.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 13:05:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103908#M21701</guid>
      <dc:creator>JohnH</dc:creator>
      <dc:date>2012-05-04T13:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Filename Statement Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103909#M21702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The FILENAME function executes during DATA step execution, while the FILE statement opens the file before the DATA step begins execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use the FILENAME in the DATA step, the DATA step compiles both the FILENAME function and FILE statement. At this point, no files have been created. Just before the DATA step executes, the fileref StatFile is opened for output (created). The fileref StatFile doesn't exist, so a file named StatFile.dat is created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the DATA step executes, the FILENAME function executes and creates the fileref StatFile. At this point, it is too late to use this fileref with the FILE statement as the FILE statement has already done its work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bago&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 13:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103909#M21702</guid>
      <dc:creator>Bago</dc:creator>
      <dc:date>2012-05-04T13:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: Filename Statement Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103910#M21703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to define the physical destination at runtime, look into the FILE statement option FILEVAR=&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 May 2012 22:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103910#M21703</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2012-05-04T22:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Filename Statement Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103911#M21704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks....This explains it to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2012 12:01:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filename-Statement-Issue/m-p/103911#M21704</guid>
      <dc:creator>JohnH</dc:creator>
      <dc:date>2012-05-07T12:01:55Z</dc:date>
    </item>
  </channel>
</rss>

