<?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 excel files with line breaks in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151592#M262514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would remove all the line breaks from your sells before exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do that by a doing a replace (ctrl+h). hold ALT while entering 010 in the "find what" field and enter a space in "replace with"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Karsten&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Nov 2013 16:27:20 GMT</pubDate>
    <dc:creator>Kfhansen</dc:creator>
    <dc:date>2013-11-21T16:27:20Z</dc:date>
    <item>
      <title>Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151591#M262513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to import an excel file into SAS using the proc import command.&lt;/P&gt;&lt;P&gt;However, some texts in the excel file are truncated when imported into SAS (because some cells contain text that are very long).&lt;/P&gt;&lt;P&gt;I tried to convert the excel file into .csv before importing into SAS, but because there are line breaks in the cells, each separate line is imported as a different variable in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex. the excel file looks like this:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="74" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; WIDTH: 860px; HEIGHT: 19px; BORDER-TOP: #000000 1px solid; BORDER-RIGHT: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Case&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Comments&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;23&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;P&gt;Positive IgG test.&lt;/P&gt;&lt;P&gt;Negative IgM test.&lt;/P&gt;&lt;P&gt;Patient hospitalized on Nov.12.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any solution to this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 14:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151591#M262513</guid>
      <dc:creator>chi0202</dc:creator>
      <dc:date>2013-11-21T14:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151592#M262514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would remove all the line breaks from your sells before exporting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do that by a doing a replace (ctrl+h). hold ALT while entering 010 in the "find what" field and enter a space in "replace with"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Karsten&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 16:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151592#M262514</guid>
      <dc:creator>Kfhansen</dc:creator>
      <dc:date>2013-11-21T16:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151593#M262515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="824054" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Of course you can use SAS to accomplish the same kind of edit of a CSV file and not have to do any of the edits in Excel. e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename datain "c:\art\multlines.csv";&lt;/P&gt;&lt;P&gt;filename dataout temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file dataout;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile datain LRECL=1 RECFM=F;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _infile_ NE "0A"x then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _infile_ eq "0D"x then put ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else put _infile_@;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile=dataout&lt;/P&gt;&lt;P&gt;&amp;nbsp; out=test dbms=csv replace;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Nov 2013 19:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151593#M262515</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-11-21T19:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151594#M262516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur,&lt;/P&gt;&lt;P&gt;Tried running your code, but the content in one cell still gets split into different variables in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151594#M262516</guid>
      <dc:creator>chi0202</dc:creator>
      <dc:date>2013-11-22T18:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151595#M262517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Typically you can prevent SAS from treating those line breaks as end-of-line by using the TERMSTR=CRLF on the INFILE statement.&amp;nbsp;&amp;nbsp; Whether PROC IMPORT is smart enough to honor the setting I do not know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try reading the file using a data step to see if it handles the line breaks.&lt;/P&gt;&lt;P&gt;This code will read the first two rows and show you the value of each cell as a character string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile '../raw/_domains.csv' dsd truncover termstr=crlf col=cc length=len obs=3 lrecl=1000000 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; row+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do col=1 by 1 until (cc &amp;gt; len) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; length cell $5000 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input cell @;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put row= col= cell= ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:45:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151595#M262517</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-11-22T18:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151596#M262518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting!&amp;nbsp; Worked perfectly for me.&amp;nbsp; What version of SAS are you running and on which operating system?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Nov 2013 04:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151596#M262518</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-11-24T04:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151597#M262519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to Arthur's question (especially, are you running on Windows or Unix), also are you using dbms=excel or dbms=xls?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you include the whole 'proc import' in your reply?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Nov 2013 20:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151597#M262519</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2013-11-27T20:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151598#M262520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur,&lt;/P&gt;&lt;P&gt;I'm running SAS 9.3 on Windows Server 2008.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS. using dbms=excel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2013 15:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151598#M262520</guid>
      <dc:creator>chi0202</dc:creator>
      <dc:date>2013-11-28T15:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151599#M262521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hopefully, when you tried the suggested code, you changed the dbms= to be dbms=csv and included a large enough guessing rows setting to capture the longest string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, I think you will either have to post a copy of the workbook, and the full code that you are using, in order for any of the forum members to be of help.&amp;nbsp; Of course, you also have the option of contact SAS tech support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Nov 2013 15:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/151599#M262521</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-11-28T15:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Importing excel files with line breaks</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/356279#M262522</link>
      <description>&lt;P&gt;Arthur, thank you so much! This finally solved my problem after an eternal Google search.&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2017 09:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-excel-files-with-line-breaks/m-p/356279#M262522</guid>
      <dc:creator>nico_</dc:creator>
      <dc:date>2017-05-05T09:19:14Z</dc:date>
    </item>
  </channel>
</rss>

