<?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 replace using infile and file. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34572#M8449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may be in luck.&amp;nbsp; I reviewed your file and, from what I could tell, every time there is a less than character (i.e., &amp;lt;), it is followed by 'br&amp;gt;&amp;lt;br&amp;gt;' and then two spaces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is correct, it simplifies matters quite a bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another thing I noticed is that the file contains numerous tab characters (i.e., '09'x).&amp;nbsp; I wasn't sure what you wanted to do with them but, given the following code, they, too, could be easily eliminated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What the code does is read the file one character at a time.&amp;nbsp; If it confronts a &amp;lt; character, it simply skips the next seven characters and, in their place, puts in a carriage return and line feed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, after it rewrites the entire file, simply imports it with proc import:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _NULL_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; FILE "c:\pedacoMarco_new.txt" RECFM=N ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile "c:\pedacoMarco.txt" RECFM=N ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input VAR1 $CHAR1. @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF VAR1 eq '&amp;lt;' THEN do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to 7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input VAR1 $CHAR1. @;&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; put '0D'x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '0A'x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else PUT VAR1 $CHAR1. ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT= WORK.WANT &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; DATAFILE= "C:\pedacoMarco_new.txt" &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; DBMS=DLM REPLACE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DELIMITER='7C'x; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAROW=2; &lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jan 2012 18:51:13 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2012-01-20T18:51:13Z</dc:date>
    <item>
      <title>replace using infile and file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34571#M8448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi people&lt;/P&gt;&lt;P&gt;Could anyone help me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need a SAS code to replace the value &amp;lt;br&amp;gt; to \n from a txt file. &lt;/P&gt;&lt;P&gt;The problem is. This txt file is combined in just one single line thus its lrecl contain 223657.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anybody can help me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I've attached the file. I need to change the values "&amp;lt;br&amp;gt;" to "\n." from txt file to the same txt file. That is replace it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please, if I could'n t be clear, let me know.&lt;/P&gt;&lt;P&gt;Thanks all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2012 16:47:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34571#M8448</guid>
      <dc:creator>Augusto</dc:creator>
      <dc:date>2012-01-20T16:47:43Z</dc:date>
    </item>
    <item>
      <title>replace using infile and file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34572#M8449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may be in luck.&amp;nbsp; I reviewed your file and, from what I could tell, every time there is a less than character (i.e., &amp;lt;), it is followed by 'br&amp;gt;&amp;lt;br&amp;gt;' and then two spaces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is correct, it simplifies matters quite a bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another thing I noticed is that the file contains numerous tab characters (i.e., '09'x).&amp;nbsp; I wasn't sure what you wanted to do with them but, given the following code, they, too, could be easily eliminated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What the code does is read the file one character at a time.&amp;nbsp; If it confronts a &amp;lt; character, it simply skips the next seven characters and, in their place, puts in a carriage return and line feed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, after it rewrites the entire file, simply imports it with proc import:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _NULL_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; FILE "c:\pedacoMarco_new.txt" RECFM=N ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile "c:\pedacoMarco.txt" RECFM=N ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input VAR1 $CHAR1. @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF VAR1 eq '&amp;lt;' THEN do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to 7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input VAR1 $CHAR1. @;&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; put '0D'x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put '0A'x;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else PUT VAR1 $CHAR1. ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC IMPORT OUT= WORK.WANT &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; DATAFILE= "C:\pedacoMarco_new.txt" &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; DBMS=DLM REPLACE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DELIMITER='7C'x; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATAROW=2; &lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2012 18:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34572#M8449</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-20T18:51:13Z</dc:date>
    </item>
    <item>
      <title>replace using infile and file.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34573#M8450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sr Art.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are definetely genius. Thanks so much it worked perfectly. I just used the String&lt;STRONG&gt; "\n"&lt;/STRONG&gt; rather then&lt;STRONG&gt;&amp;nbsp; put '0D'x;&amp;nbsp; put '0A'x. Thanks again you always respond my discussion with a great solution.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2012 20:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/replace-using-infile-and-file/m-p/34573#M8450</guid>
      <dc:creator>Augusto</dc:creator>
      <dc:date>2012-01-20T20:38:03Z</dc:date>
    </item>
  </channel>
</rss>

