<?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: Add The Columns to Text File in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4177#M1722</link>
    <description>Ihor &lt;BR /&gt;
&lt;BR /&gt;
you might like to build a generic "transform" as a proc print report using ODS to write to CSV. By default, you can get all columns written with even simpler code, like :[pre]&lt;BR /&gt;
ods  close _all_ ;&lt;BR /&gt;
ods  csv   file= "&amp;amp;_extfile" /* pulled from generic report surface */&lt;BR /&gt;
proc print data=  &amp;amp;_input1   /* pulled from generic report surface */&lt;BR /&gt;
           noobs ;&lt;BR /&gt;
  var _all_ ;&lt;BR /&gt;
run;&lt;BR /&gt;
ods _all_ close ;&lt;BR /&gt;
ods listing ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Although, for all columns, you really don't need that VAR statement, I placed it there as a reminder that you can probably use the DI Studio surface to select the columns you want to be written, and these would be placed in a macro variable you would use like [pre]   VAR &amp;amp;_columns ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 Good Luck&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
    <pubDate>Thu, 16 Aug 2007 09:41:31 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-08-16T09:41:31Z</dc:date>
    <item>
      <title>Add The Columns to Text File</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4175#M1720</link>
      <description>Hello All&lt;BR /&gt;
&lt;BR /&gt;
I'm not sure, where should I post message about Data Integration Studio, so I'll try to do it here.&lt;BR /&gt;
&lt;BR /&gt;
I use FileWriter in DIS to copy table to text file. It works good, but I need to add column names in first line. Help please, if somebody knows how to do it.&lt;BR /&gt;
&lt;BR /&gt;
If nobody knows, than it will be great if you write a piece of code which will do this.&lt;BR /&gt;
&lt;BR /&gt;
Thank you</description>
      <pubDate>Tue, 14 Aug 2007 13:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4175#M1720</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-14T13:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Add The Columns to Text File</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4176#M1721</link>
      <description>Hi again&lt;BR /&gt;
I have already found the solution of my question.&lt;BR /&gt;
It is necessary to add the next code to user written code in FileWriter.&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;data _null_;&lt;BR /&gt;
       set &amp;amp;syslast;&lt;BR /&gt;
       &lt;BR /&gt;
       attrib Field1 length = 8;&lt;BR /&gt;
       attrib Field2 length = $40;&lt;BR /&gt;
       attrib Field3 length = 8 format = commax16.2;&lt;BR /&gt;
&lt;BR /&gt;
       file "D:\MyFolder\FileName.txt" dlm = ";";&lt;BR /&gt;
&lt;BR /&gt;
       if _n_ = 1 then put 'Field1;Field2;Field3';&lt;BR /&gt;
&lt;BR /&gt;
       put Field1&lt;BR /&gt;
             Field2&lt;BR /&gt;
             Field3;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;/B&gt;</description>
      <pubDate>Thu, 16 Aug 2007 07:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4176#M1721</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-16T07:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add The Columns to Text File</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4177#M1722</link>
      <description>Ihor &lt;BR /&gt;
&lt;BR /&gt;
you might like to build a generic "transform" as a proc print report using ODS to write to CSV. By default, you can get all columns written with even simpler code, like :[pre]&lt;BR /&gt;
ods  close _all_ ;&lt;BR /&gt;
ods  csv   file= "&amp;amp;_extfile" /* pulled from generic report surface */&lt;BR /&gt;
proc print data=  &amp;amp;_input1   /* pulled from generic report surface */&lt;BR /&gt;
           noobs ;&lt;BR /&gt;
  var _all_ ;&lt;BR /&gt;
run;&lt;BR /&gt;
ods _all_ close ;&lt;BR /&gt;
ods listing ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Although, for all columns, you really don't need that VAR statement, I placed it there as a reminder that you can probably use the DI Studio surface to select the columns you want to be written, and these would be placed in a macro variable you would use like [pre]   VAR &amp;amp;_columns ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 Good Luck&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Thu, 16 Aug 2007 09:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-The-Columns-to-Text-File/m-p/4177#M1722</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-16T09:41:31Z</dc:date>
    </item>
  </channel>
</rss>

