<?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 Split Chattext into multiple lines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935973#M367934</link>
    <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working on a dataset where the &lt;CODE&gt;Chattext&lt;/CODE&gt; column contains a long string of text that I need to split into multiple lines, as demonstrated in the desired output format below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached file with input data and desired output results I'm looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2024 23:02:09 GMT</pubDate>
    <dc:creator>krishnaavm123</dc:creator>
    <dc:date>2024-07-16T23:02:09Z</dc:date>
    <item>
      <title>Split Chattext into multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935973#M367934</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working on a dataset where the &lt;CODE&gt;Chattext&lt;/CODE&gt; column contains a long string of text that I need to split into multiple lines, as demonstrated in the desired output format below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached file with input data and desired output results I'm looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2024 23:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935973#M367934</guid>
      <dc:creator>krishnaavm123</dc:creator>
      <dc:date>2024-07-16T23:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Split Chattext into multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935977#M367936</link>
      <description>&lt;P&gt;Looks like you split the example some how, what logic did you use? Why did you split it at those locations?&amp;nbsp; Explain the rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try any SAS code?&amp;nbsp; How well did it work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS&amp;nbsp; No need to attach a file.&amp;nbsp; You can post simple text using the Insert Code button to get a pop-up window.&lt;/P&gt;
&lt;PRE&gt;Chat_id   Chattext
101       10/05/2024 10:15:00 krishna.vangalli@gmail.com hello Raju how are you 10/05/2024 10:16:15 Raju@gmail.com Hey krishna whatsup I'm doing good   
102       10/06/2024 11:15:00 krish.vangalli@gmail.com hello  10/06/2024 10:16:15 Raju@gmail.com Hey krishna whatsup I'm doing good&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jul 2024 00:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935977#M367936</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-07-17T00:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Split Chattext into multiple lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935979#M367938</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input Chat_id   Chattext $200.;
cards;
101       10/05/2024 10:15:00 krishna.vangalli@gmail.com hello Raju how are you 10/05/2024 10:16:15 Raju@gmail.com Hey krishna whatsup I'm doing good   
102       10/06/2024 11:15:00 krish.vangalli@gmail.com hello  10/06/2024 10:16:15 Raju@gmail.com Hey krishna whatsup I'm doing good
;
data want;
 set have;
 pid=prxparse('/\d+\/\d+\/\d+/');
 s=1;e=length(Chattext);
 call prxnext(pid,s,e,Chattext,p,l);
 do while(p&amp;gt;0);
   _p=p;
   call prxnext(pid,s,e,Chattext,p,l);
   if p&amp;gt;0 then temp=substr(Chattext,_p,p-_p);
     else temp=substr(Chattext,_p);

   	 date=scan(temp,1,,'s');
	 time=scan(temp,2,,'s');
	 sender=scan(temp,3,,'s');
	 call scan(temp,3,p2,l2,,'s');
     chat_text=substr(temp,p2+l2);
     output;
 end;
 keep Chat_id   date          time        sender       chat_text  ;
 run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jul 2024 01:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-Chattext-into-multiple-lines/m-p/935979#M367938</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-07-17T01:56:51Z</dc:date>
    </item>
  </channel>
</rss>

