<?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 FILE statement in DATA _NULL_ (no quick answer from Google) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10025#M652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need people help me to explain what does the FILE statement do here and what is the purpose of this DATA step?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FILENAME TEMPMK '/home/.../TEMPMK';&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILE TEMPMK NOPRINT NOTITLE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF _N_ = 1 THEN DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET HEADER;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECORDS = &amp;amp;TOTRECS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT FILETYPE &amp;amp;TAB RECORDS &amp;amp;TAB FILENAME &amp;amp;TAB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILEID &amp;amp;TAB FILEYEAR &amp;amp;TAB ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET COUNT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT RECORDNO &amp;amp;TAB FIPS &amp;amp;TAB STATEAGN &amp;amp;TAB &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISTRICT &amp;amp;TAB &amp;amp;TABF &amp;amp;TAB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ImpDS &amp;amp;TAB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXPLAIN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Dec 2011 22:51:35 GMT</pubDate>
    <dc:creator>TDub</dc:creator>
    <dc:date>2011-12-06T22:51:35Z</dc:date>
    <item>
      <title>FILE statement in DATA _NULL_ (no quick answer from Google)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10025#M652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need people help me to explain what does the FILE statement do here and what is the purpose of this DATA step?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FILENAME TEMPMK '/home/.../TEMPMK';&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILE TEMPMK NOPRINT NOTITLE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF _N_ = 1 THEN DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET HEADER;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECORDS = &amp;amp;TOTRECS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT FILETYPE &amp;amp;TAB RECORDS &amp;amp;TAB FILENAME &amp;amp;TAB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FILEID &amp;amp;TAB FILEYEAR &amp;amp;TAB ' ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET COUNT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT RECORDNO &amp;amp;TAB FIPS &amp;amp;TAB STATEAGN &amp;amp;TAB &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISTRICT &amp;amp;TAB &amp;amp;TABF &amp;amp;TAB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ImpDS &amp;amp;TAB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EXPLAIN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2011 22:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10025#M652</guid>
      <dc:creator>TDub</dc:creator>
      <dc:date>2011-12-06T22:51:35Z</dc:date>
    </item>
    <item>
      <title>FILE statement in DATA _NULL_ (no quick answer from Google)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10026#M653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The file statement is there so that when you use a put statement it will put the data into the file.&lt;/P&gt;&lt;P&gt;The purpose of the datastep appears to be to write a header record and some other data to a file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2011 23:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10026#M653</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-12-06T23:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: FILE statement in DATA _NULL_ (no quick answer from Google)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10027#M654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume from the macro variable names the intent is a TAB delimited file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that with the addition of the DSD and DLM options to the FILE statement you could probably get rid of the &amp;amp;TAB macro variable references.&amp;nbsp; But what the purpose of &amp;amp;TABF macro variable is I can only guess perhaps to have any empty column?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename tempmk dsd dlm="&amp;amp;tab";&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;PUT FILETYPE RECORDS FILENAME FILEID FILEYEAR ' ';&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;PUT RECORDNO FIPS STATEAGN DISTRICT &amp;amp;TABF ImpDS EXPLAIN;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2011 00:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10027#M654</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-07T00:02:03Z</dc:date>
    </item>
    <item>
      <title>FILE statement in DATA _NULL_ (no quick answer from Google)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10028#M655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the beyond_original_question answer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2011 00:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10028#M655</guid>
      <dc:creator>TDub</dc:creator>
      <dc:date>2011-12-07T00:52:52Z</dc:date>
    </item>
    <item>
      <title>FILE statement in DATA _NULL_ (no quick answer from Google)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10029#M656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But when I use dsd dlm="&amp;amp;tab" to run it, I found "+" was between the variables instead of TAB space. Any hint?&lt;/P&gt;&lt;P&gt;Could you also explain how the macro variable TAB was defined? You are right, &amp;amp;TABF does generate an empty column. But how "+(-1)&amp;nbsp;&amp;nbsp; '09'X" be resolved to a tab?&lt;/P&gt;&lt;P&gt;%LET TAB =+(-1)&amp;nbsp;&amp;nbsp; '09'X;&lt;/P&gt;&lt;P&gt;%LET TABF =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '09'X;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2011 01:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10029#M656</guid>
      <dc:creator>TDub</dc:creator>
      <dc:date>2011-12-07T01:06:25Z</dc:date>
    </item>
    <item>
      <title>FILE statement in DATA _NULL_ (no quick answer from Google)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10030#M657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The +(-1) is tell it to back over the extra space that it normally puts between variables when using this list mode style of put statement.&amp;nbsp; The +(-1) is not needed when using DSD option.&amp;nbsp; You do not want the cursor movement command in your delimiter, so you would want to set DLM='09'x in the FILE statement.&amp;nbsp; (or you could use dlm=&amp;amp;tabf as it would be the same thing).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The use of &amp;amp;TABF is to have it put out two tabs with no space between them.&amp;nbsp; To mimic that with DSD option you will need to make an empty char variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;blank=' ';&lt;/P&gt;&lt;P&gt;PUT RECORDNO FIPS STATEAGN DISTRICT blank ImpDS EXPLAIN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2011 02:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILE-statement-in-DATA-NULL-no-quick-answer-from-Google/m-p/10030#M657</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-12-07T02:43:31Z</dc:date>
    </item>
  </channel>
</rss>

