<?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: Removing linefeeds in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134220#M36439</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hexadecimal notation is '10'x .&lt;/P&gt;&lt;P&gt;If the file was created on Unix there will not be an easy way to distinguish the embedded LFs from the ones that are used to mark the end of the line.&lt;/P&gt;&lt;P&gt;If the file was created on Windows/DOS then you could try adding the TERMSTR=CRLF option to your INFILE statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 May 2013 15:47:54 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2013-05-15T15:47:54Z</dc:date>
    <item>
      <title>Removing linefeeds</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134218#M36437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my first post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a a2.csv file in which some fields contain linefeeds. I want to make a data set from this with linefeeds removed. The first column has the variables v1 v2 v3 v4, the first numeric and 3 observations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Two approaches:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data trial;&lt;/P&gt;&lt;P&gt;infile 'C:\HRH-C\pet\a2.csv' dsd delimiter=';' firstobs=2;&lt;/P&gt;&lt;P&gt;input v1 v2 $ v3 $ v4 $;&lt;/P&gt;&lt;P&gt;v1= TRANWRD(v1,'0A'x,"");&lt;/P&gt;&lt;P&gt;v2= TRANWRD(v2,'0A'x,"");&lt;/P&gt;&lt;P&gt;v3= TRANWRD(v3,'0A'x,"");&lt;/P&gt;&lt;P&gt;v4= TRANWRD(v4,'0A'x,"");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data trial;&lt;/P&gt;&lt;P&gt;infile 'C:\HRH-C\pet\a2.csv' dsd delimiter=';' firstobs=2;&lt;/P&gt;&lt;P&gt;input v1 v2 $ v3 $ v4 $;&lt;/P&gt;&lt;P&gt;v1=compress(v1,,"kw");&lt;/P&gt;&lt;P&gt;v2=compress(v2,,"kw");&lt;/P&gt;&lt;P&gt;v3=compress(v3,,"kw");&lt;/P&gt;&lt;P&gt;v4=compress(v4,,"kw");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but neither of them seems to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If instead of a linefeed I put another character in the csv file and use the corresponding first version, it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas? (I would like to try the ascii code 10 for the linefeed too but I don't know the syntax for the ascii code..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Anastasios Kotronis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 13:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134218#M36437</guid>
      <dc:creator>akotronis</dc:creator>
      <dc:date>2013-05-15T13:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Removing linefeeds</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134219#M36438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using&lt;/P&gt;&lt;P&gt;v1= TRANSLATE(v1,"",'0A'x);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function TRANWRD looks for white space to delimit words - so probably considers '0A'x as white space.&lt;/P&gt;&lt;P&gt;NOTE: the arguments to TRANSLATE need to be swapped around from TRANWRD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 15:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134219#M36438</guid>
      <dc:creator>TimArm</dc:creator>
      <dc:date>2013-05-15T15:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Removing linefeeds</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134220#M36439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hexadecimal notation is '10'x .&lt;/P&gt;&lt;P&gt;If the file was created on Unix there will not be an easy way to distinguish the embedded LFs from the ones that are used to mark the end of the line.&lt;/P&gt;&lt;P&gt;If the file was created on Windows/DOS then you could try adding the TERMSTR=CRLF option to your INFILE statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 15:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134220#M36439</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-15T15:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Removing linefeeds</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134221#M36440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found TERMSTR=CRL, as you suggest, just before TimArm answered, here&amp;nbsp; (&lt;A href="http://stackoverflow.com/questions/3709970/how-to-import-multiline-csv-in-sas" title="http://stackoverflow.com/questions/3709970/how-to-import-multiline-csv-in-sas"&gt;How to import multiline CSV in SAS - Stack Overflow&lt;/A&gt;) and it worked just fine. Thank you both for your time (by the way, the TRANSLATE suggestion doesn't work neither. I don't why, but, as for the COMPREES case, from what I concluded by what I found on the web, it seems to work if you already have your data in a sas data set.)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 16:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134221#M36440</guid>
      <dc:creator>akotronis</dc:creator>
      <dc:date>2013-05-15T16:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Removing linefeeds</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134222#M36441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've had run-ins with CR and LF as well, so I thought I'd chime in even though you found your solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution may provide insight: &lt;A href="http://support.sas.com/kb/26/065.html"&gt;http://support.sas.com/kb/26/065.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And this code may help too: &lt;A href="http://studysas.blogspot.ca/2011/10/how-to-remove-carriage-return-and.html"&gt;http://studysas.blogspot.ca/2011/10/how-to-remove-carriage-return-and.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is a one-time occurence, you can use the open source software Notepad++ to quickly convert the file to the "Classic Mac" format.&amp;nbsp; It will convert all Line Feeds LF to Carriage Returns CR.&amp;nbsp; (Apparently newer Macs (not "Classic" Macs) now use LF for end of line EOL.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or, if you have MS Excel, you can open up your CSV and use this VB macro to remove Line Feeds. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub CleanCells()&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'Strips special characters (line feeds, etc.) from all selected cells&lt;/P&gt;&lt;P&gt;&amp;nbsp; Dim Cell&amp;nbsp;&amp;nbsp;&amp;nbsp; As Range&lt;/P&gt;&lt;P&gt;&amp;nbsp; For Each Cell In Selection&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cell.Value = WorksheetFunction.Clean(Cell.Value)&lt;/P&gt;&lt;P&gt;&amp;nbsp; Next Cell&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are getting your data file from an FTP server to a Windows computer and you know the file on the server does not contain LF, then be sure to download the file using binary transfer mode and not ASCII.&amp;nbsp; This will retain the CR and not add LF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 May 2013 19:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134222#M36441</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-05-17T19:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Removing linefeeds</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134223#M36442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your time. In excel an easier way to remove the line feeds would be =substitute(a2;char(10);"") assuming the cell with the linefeed is A2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 May 2013 01:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Removing-linefeeds/m-p/134223#M36442</guid>
      <dc:creator>akotronis</dc:creator>
      <dc:date>2013-05-18T01:10:34Z</dc:date>
    </item>
  </channel>
</rss>

