<?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 csv file with column names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304712#M64871</link>
    <description>&lt;P&gt;I need to amend this data step so that the column names are written to output file in row 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename csv "G:\Departments\Research\MAP\&amp;amp;yr1&amp;amp;yr2.\Fall &amp;amp;yr.\clean_for_enrich.csv";&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;set join1b ;&lt;BR /&gt;file csv dlm=',';&lt;BR /&gt;put ( _all_ ) (+0);&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Oct 2016 16:25:26 GMT</pubDate>
    <dc:creator>GreggB</dc:creator>
    <dc:date>2016-10-14T16:25:26Z</dc:date>
    <item>
      <title>csv file with column names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304712#M64871</link>
      <description>&lt;P&gt;I need to amend this data step so that the column names are written to output file in row 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename csv "G:\Departments\Research\MAP\&amp;amp;yr1&amp;amp;yr2.\Fall &amp;amp;yr.\clean_for_enrich.csv";&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;set join1b ;&lt;BR /&gt;file csv dlm=',';&lt;BR /&gt;put ( _all_ ) (+0);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 16:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304712#M64871</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-14T16:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: csv file with column names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304729#M64877</link>
      <description>&lt;P&gt;Easiest may be&lt;/P&gt;
&lt;P&gt;Proc export data=join1b outfile=csv dbms=csv;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 17:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304729#M64877</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-14T17:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: csv file with column names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304733#M64878</link>
      <description>&lt;P&gt;Agreed. I was making it &amp;nbsp;too complicated.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 17:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304733#M64878</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-10-14T17:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: csv file with column names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304776#M64891</link>
      <description>&lt;P&gt;If you need to provide a specific order, such for a file that&amp;nbsp;may be read by another program that requires a fixed order then the PUT statement would be appropriate but since you didn't show that then I though export would work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easy semi-kludge for the header row is to include something like this BEFORE the Put statement in the order to match the variables on the put statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If _n_ = 1 then put '"column 1 text","column 2 text", ...,"column n text"';&lt;/P&gt;
&lt;P&gt;note that is '&amp;nbsp; "&amp;nbsp;&amp;nbsp; and "&amp;nbsp;&amp;nbsp;' at the start and end. If there are no spaces or commas desired in the Column x text then the&amp;nbsp;" could be omitted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;line basically&amp;nbsp;says: If this is the first line of the file then put the header row.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 19:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/csv-file-with-column-names/m-p/304776#M64891</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-14T19:35:48Z</dc:date>
    </item>
  </channel>
</rss>

