<?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: Importing/Exporting ASCII File in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530672#M145139</link>
    <description>&lt;P&gt;Just use another DATA step to write the file.&amp;nbsp; Instead of INFILE and INPUT you would use FILE and PUT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set WantImport;
  file "File.txt" ;
  put
    @1 Var1 Best4.
    @5 Var2 $Char1.
    @6 Var3 $Char35.
    @41 Var4 $Char35.
    @76 Var5 $Char20.
    ....
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Jan 2019 16:20:24 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-01-28T16:20:24Z</dc:date>
    <item>
      <title>Importing/Exporting ASCII File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530655#M145136</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;I am hoping there are some solutions to my problem. I have imported an ASCII file with over 500 variables into SAS using the Infile and Input statements as listed below:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Data WantImport;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Infile "File.txt" lrecl=4906 truncover;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Input&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;@&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; Var1 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;Best4.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;@&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; Var2 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$Char1.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;@&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;6&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; Var3 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$Char35.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;@&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;41&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; Var4 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$Char35.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;@&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;76&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; Var5 &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;$Char20.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;.....&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="3"&gt;I then modified the file using a second database as a comparison file. Now I am wanting to export the ASCII file from SAS back into an ASCII file.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;&lt;FONT color="#000000"&gt;The proc export examples I have seen&amp;nbsp;as shown below&lt;/FONT&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;export&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=datawant&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;outfile&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"filename.txt"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;dbms&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=dlm &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;replace&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;''&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;putnames&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=no;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;does not account for the original ASCII format as referenced by the Input statement above. There are no delimiters just the variable name, length,type and other values written in the input statement.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Is there a special export statement for ASCII files?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Thank you in advance for your help.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 15:51:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530655#M145136</guid>
      <dc:creator>corsan</dc:creator>
      <dc:date>2019-01-28T15:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Importing/Exporting ASCII File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530661#M145137</link>
      <description>&lt;P&gt;Not being able to see the file, means its very difficult to say.&amp;nbsp; In the read statement you do not say what the delimiter in that file is, so is the file not delimited, but actually uses fixed widths?&amp;nbsp; Afraid its just guess work as we cannot see the file.&lt;/P&gt;
&lt;P&gt;As to the final point, no there is nothing special to an ASCII file, all that means is its a text file, just like an rtf, or a csv or html or xml.&amp;nbsp; There are numerous methods to writing data out to text files, again without seeing what is needed, I can't advise.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 15:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530661#M145137</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-01-28T15:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Importing/Exporting ASCII File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530670#M145138</link>
      <description>&lt;P&gt;Thank you for responding. Yes the file uses fixed widths. Please see attached. I&amp;nbsp; have attached the&amp;nbsp;varialbe&amp;nbsp;order, length and type for the 529 variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 16:12:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530670#M145138</guid>
      <dc:creator>corsan</dc:creator>
      <dc:date>2019-01-28T16:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Importing/Exporting ASCII File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530672#M145139</link>
      <description>&lt;P&gt;Just use another DATA step to write the file.&amp;nbsp; Instead of INFILE and INPUT you would use FILE and PUT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set WantImport;
  file "File.txt" ;
  put
    @1 Var1 Best4.
    @5 Var2 $Char1.
    @6 Var3 $Char35.
    @41 Var4 $Char35.
    @76 Var5 $Char20.
    ....
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jan 2019 16:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530672#M145139</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-28T16:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Importing/Exporting ASCII File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530677#M145140</link>
      <description>&lt;P&gt;Thank&amp;nbsp;you for the response! It worked. I appreciate it.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 16:37:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530677#M145140</guid>
      <dc:creator>corsan</dc:creator>
      <dc:date>2019-01-28T16:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Importing/Exporting ASCII File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530697#M145142</link>
      <description>&lt;P&gt;Please mark&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;'s answer as the correct answer, not your response to him.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 18:05:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Exporting-ASCII-File/m-p/530697#M145142</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-01-28T18:05:16Z</dc:date>
    </item>
  </channel>
</rss>

