<?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: Read multiple lines from an excel cell into SAS dataset using Excel-SAS Add-in. in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561504#M5892</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I do not know much about xml format, but I just tried to enter your text using Alt + Enter. Although the entered texts appear to be in separate lines in Excel, they are still in a single field (they still take up one row and one column). Your texts also do not seem to have any delimiters other than blanks. My suggestion would be to enter the lines in different rows in Excel.</description>
    <pubDate>Fri, 24 May 2019 18:03:04 GMT</pubDate>
    <dc:creator>aaronh</dc:creator>
    <dc:date>2019-05-24T18:03:04Z</dc:date>
    <item>
      <title>Read multiple lines from an excel cell into SAS dataset using Excel-SAS Add-in.</title>
      <link>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561465#M5891</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to read some excel data into the SAS stored processes. I use SAS Add-in for microsoft office.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem here is, the data is read into SAS but when I input some text into excel i multiple lines using &lt;STRONG&gt;Alt+Enter&lt;/STRONG&gt;, the data is still read and &lt;STRONG&gt;stored in a single line&lt;/STRONG&gt;. (When I read the data in EG /output this back to excel, I get those two lines concatenated as a sinle line).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Excel cell value contains text in multiple lines (entered using Alt+Enter):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This is line one of my text&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Here is line two.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This value is stored as &lt;EM&gt;This is line one of my text Here is line two.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Note :&lt;/U&gt; My text does not have a particular pattern.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am calling the stored process from VBA. Below are the configurations in my stored process.&lt;/P&gt;&lt;P&gt;Input data type : XML Data Source&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected content type: text/xml.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the below code in stored process to read and save the excel cell as dataset.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname myexcelrange xml;

data mylib.dummy;
	set myexcelrange.excel_table;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please help me in storing and retrieving this data in multiple lines.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 16:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561465#M5891</guid>
      <dc:creator>Karthveeryarjun</dc:creator>
      <dc:date>2019-05-24T16:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple lines from an excel cell into SAS dataset using Excel-SAS Add-in.</title>
      <link>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561504#M5892</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I do not know much about xml format, but I just tried to enter your text using Alt + Enter. Although the entered texts appear to be in separate lines in Excel, they are still in a single field (they still take up one row and one column). Your texts also do not seem to have any delimiters other than blanks. My suggestion would be to enter the lines in different rows in Excel.</description>
      <pubDate>Fri, 24 May 2019 18:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561504#M5892</guid>
      <dc:creator>aaronh</dc:creator>
      <dc:date>2019-05-24T18:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Read multiple lines from an excel cell into SAS dataset using Excel-SAS Add-in.</title>
      <link>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561505#M5893</link>
      <description>&lt;P&gt;When you read the data out of Excel sheet into a SAS dataset each cell in the sheet becomes the value of one variable in one observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to split it into multiple observations (or multipe variables) then use the SCAN() function.&amp;nbsp; Check your actual data to see if the lines are split by linefeed characters ('0A'x) or carriage return characters ('0D'x).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you read the data into a dataset named HAVE and the variable that has to "split" cells is name MYVAR then this code will create a separate observation for each value.&amp;nbsp; With the new variable I having the count of which value it was and the new variable SPLITVAR having individual part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data many_lines;
   set have;
   length splitvar $100;
   do i=1 by 1 until(i&amp;gt;countw(myvar,'0A'x));
     splitvar=scan(myvar,i,'0A'x);
     output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is the way to split them into multiple variables instead. Note that you need to set a fixed upper bound on the number of lines thta a cell could contain.&amp;nbsp; In this example I used 10.&amp;nbsp; So there will be 10 new variables SPLITVAR1 to SPLITVAR10. And I should have either the number of values or 11 if there were more than 10.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data many_vars;
   set have;
   array splitvar [10]  $100;
   do i=1 to dim(splitvar) while (i&amp;lt;=countw(myvar,'0A'x));
     splitvar[i]=scan(myvar,i,'0A'x);
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For both examples I made the new variable have room for only 100 characters.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 18:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Read-multiple-lines-from-an-excel-cell-into-SAS-dataset-using/m-p/561505#M5893</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-24T18:21:03Z</dc:date>
    </item>
  </channel>
</rss>

