<?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: How to put header in a fixed format file? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440855#M110220</link>
    <description>&lt;P&gt;Why can't we add header record here?&amp;nbsp; Can we add labels on fixed positions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2018 11:52:54 GMT</pubDate>
    <dc:creator>SASInd</dc:creator>
    <dc:date>2018-02-28T11:52:54Z</dc:date>
    <item>
      <title>How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440845#M110214</link>
      <description>&lt;P&gt;Hi I have below data and I need to provide header for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Input Data set:&amp;nbsp; 100&amp;nbsp;018 XX&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200 172 ZZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired Output: A&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; C&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; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;100&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;018 XX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200 172 ZZ&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only want this output in a data set, not in a report.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440845#M110214</guid>
      <dc:creator>SASInd</dc:creator>
      <dc:date>2018-02-28T11:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440846#M110215</link>
      <description>&lt;P&gt;You can't put character data into numeric variables, so this won't be possible.&lt;/P&gt;
&lt;P&gt;What for do you want to do that, anyway? Columns have names, and additional information can be put into column labels.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440846#M110215</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-28T11:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440848#M110216</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp; I am creating a flat file on mainframes, and i want to put labels or header (since this will be only on the first record) on the data on fixed positions.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440848#M110216</guid>
      <dc:creator>SASInd</dc:creator>
      <dc:date>2018-02-28T11:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440849#M110217</link>
      <description>&lt;P&gt;There is a logical conflict between title and description: the title reads "How to put header in a fixed format file?" and later on you write "I only want this output in a data set, not in a report.". Why do you want that text in a dataset? Does not make sense, especially because all variables have to be converted to alphanumeric before a title-observation could be added.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Posting the code you are using to create the fixed format text file will make it easier to suggest something useful.&lt;/P&gt;
&lt;DIV class="lia-quilt-column lia-quilt-column-20 lia-quilt-column-left"&gt;
&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-left"&gt;
&lt;DIV class="lia-message-subject"&gt;
&lt;DIV&gt;
&lt;DIV class="MessageReadByModeratorCell lia-moderation-moderated"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440849#M110217</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-02-28T11:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440851#M110219</link>
      <description>&lt;P&gt;You were specifically talking about a dataset, quote:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I only want this output in a data set, not in a report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please make up your mind.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440851#M110219</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-28T11:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440855#M110220</link>
      <description>&lt;P&gt;Why can't we add header record here?&amp;nbsp; Can we add labels on fixed positions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440855#M110220</guid>
      <dc:creator>SASInd</dc:creator>
      <dc:date>2018-02-28T11:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440858#M110221</link>
      <description>&lt;P&gt;Please read my post again, i explained what is necessary to add a header observation. And i repeat: this is not recommended! Writing additional lines of text while creating the text file, is possible. You don't have to add that row to the dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 12:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440858#M110221</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-02-28T12:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440875#M110225</link>
      <description>&lt;P&gt;If you want to put in a header in a typical fixed-length mainframe file, do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a b c $;
cards;
100 018 XX
200 172 ZZ
;
run;

data _null_;
set have;
file '$HOME/sascommunity/flatfile' recfm=f lrecl=8;
if _n_ = 1 then put '  A  B C';
put
  a z3.
  b z3.
  c $2.
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will have to use MF-style file syntax, of course, probably a fileref derived from a DD in the JCL that calls the SAS program. Just make sure that your SAS lrecl matches the LRECL in the JCL, and fits your lengths of the put statements&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 13:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/440875#M110225</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-28T13:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to put header in a fixed format file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/441183#M110321</link>
      <description>&lt;P&gt;Assuming that you want to put it into a text file and are just calling it a data set because of confusion with old mainframe terminology for a disk file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem with adding a "HEADER" to a fixed format file is just how to make those meaningful.&amp;nbsp; What if you are writing a single byte code for GENDER then where in the first line can you write the heading for that column?&lt;/P&gt;
&lt;P&gt;But assuming you have figured that out then just use the automatic variable _N_ to tell when you are on the first observation and write the header line then.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set have ;
  file 'output_file' ;
  if _n_=1 then the put '  A  B  C';
  put (A B C) (3.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 13:37:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-header-in-a-fixed-format-file/m-p/441183#M110321</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-01T13:37:54Z</dc:date>
    </item>
  </channel>
</rss>

