<?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 Splitting one row to multiple rows and assigning separate identifier to each row in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617864#M19144</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your kind help to split a string available in one column of my data into multiple rows based on different bullets such&amp;nbsp; A, B,&amp;nbsp; 1, 2, A., B., C. , A), B), A:, B:, A- and B-. Finally I want to assign an identifier to each row.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA have;
text= "1) POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED.
 2) POLYP AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 3. ADENOMA AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 4. ADENOMA FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND.
 A- ADENOMATOUS TISSUE AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED.
 B- ADENOMATOUS TISSUE AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 A: POLYP FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND.
 B: POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."
;
RUN;


DATA want;
length text $100 ;
id=1; text="1) POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."; output;
id=2; text="2) POLYP AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS." ; output;
id=3; text="3. ADENOMA AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS." ; output;
id=4; text="4. ADENOMA FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND."; output;
id=5; text="A- ADENOMATOUS TISSUE AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."; output;
id=6; text="B- ADENOMATOUS TISSUE AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS." ; output;
id=7; text="A: POLYP FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND."; output;
id=8; text="B: POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."; output;
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you in advance for your kind reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2020 18:57:33 GMT</pubDate>
    <dc:creator>DeepakSwain</dc:creator>
    <dc:date>2020-01-16T18:57:33Z</dc:date>
    <item>
      <title>Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617864#M19144</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your kind help to split a string available in one column of my data into multiple rows based on different bullets such&amp;nbsp; A, B,&amp;nbsp; 1, 2, A., B., C. , A), B), A:, B:, A- and B-. Finally I want to assign an identifier to each row.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA have;
text= "1) POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED.
 2) POLYP AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 3. ADENOMA AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 4. ADENOMA FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND.
 A- ADENOMATOUS TISSUE AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED.
 B- ADENOMATOUS TISSUE AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 A: POLYP FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND.
 B: POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."
;
RUN;


DATA want;
length text $100 ;
id=1; text="1) POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."; output;
id=2; text="2) POLYP AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS." ; output;
id=3; text="3. ADENOMA AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS." ; output;
id=4; text="4. ADENOMA FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND."; output;
id=5; text="A- ADENOMATOUS TISSUE AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."; output;
id=6; text="B- ADENOMATOUS TISSUE AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS." ; output;
id=7; text="A: POLYP FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND."; output;
id=8; text="B: POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."; output;
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you in advance for your kind reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 18:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617864#M19144</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2020-01-16T18:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617868#M19145</link>
      <description>Does your original text have line feeds in it to define the different rows, or is it only identifiable via he 1), 2), 3., 4., A- type output? Is it possible to have A. A- or A: in the text as well as the first character set delimiter?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617868#M19145</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-16T19:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617881#M19146</link>
      <description>Hi Reeza,&lt;BR /&gt;Thank you for your quick reply. There is no line feed or separate rows. Often all lines are available in a single or multiple paragraph format.</description>
      <pubDate>Thu, 16 Jan 2020 19:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617881#M19146</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2020-01-16T19:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617911#M19147</link>
      <description>&lt;P&gt;And this question:&amp;nbsp;&lt;SPAN&gt;Is it possible to have A. A- or A: in the text as well as the first character set delimiter?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 19:56:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617911#M19147</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-16T19:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617917#M19148</link>
      <description>&lt;P&gt;If the answer to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s question about A. A- A: is yes, Here's a question that might mitigate the problem&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do all desired text items end with a period?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:13:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/617917#M19148</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-01-16T20:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618071#M19166</link>
      <description>Yes</description>
      <pubDate>Fri, 17 Jan 2020 13:13:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618071#M19166</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2020-01-17T13:13:46Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618072#M19167</link>
      <description>Not always ends with period</description>
      <pubDate>Fri, 17 Jan 2020 13:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618072#M19167</guid>
      <dc:creator>DeepakSwain</dc:creator>
      <dc:date>2020-01-17T13:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618126#M19172</link>
      <description>&lt;P&gt;Then you need to provide a more robust example data set that has cases like that to ensure any solution works for your actual data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know that there will be a robust way to solve this given everything you've said though, except for manually and even then it's hard because the rules are ambiguous.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618126#M19172</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-17T16:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting one row to multiple rows and assigning separate identifier to each row</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618269#M19186</link>
      <description>&lt;PRE&gt;DATA have;
text= "1) POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED.
 2) POLYP AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 3. ADENOMA AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 4. ADENOMA FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND.
 A- ADENOMATOUS TISSUE AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED.
 B- ADENOMATOUS TISSUE AT RIGHT COLON: INFLAMMATORY. NEGATIVE FOR TUBULOVILLOUS. 
 A: POLYP FROM TRANSVERSE COLON: NEGATIVE FOR INFLAMMATORY BUT SERRATED IS FOUND.
 B: POLYP AT LEFT COLON: TUBULOVILLOUS. NEGATIVE FOR SERRATED."
;
RUN;

data temp;
 set have;
 n+1;
 pid=prxparse('/\b\w\W/');
 s=1;e=length(text);
 call prxnext(pid,s,e,text,p,l);
 do id=1 by 1 while(p&amp;gt;0);
  want=substr(text,p,l);output;
  call prxnext(pid,s,e,text,p,l);
 end;
 keep n p text;
run;
data want;
 merge temp temp(firstobs=2 keep=n p rename=(n=_n p=_p));
 if n=_n then want=substr(text,p,_p-p);
  else want=substr(text,p);
 if first.n then id=0;
 id+1;
 keep n id want;
 run;
&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Jan 2020 17:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Splitting-one-row-to-multiple-rows-and-assigning-separate/m-p/618269#M19186</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-01-18T17:00:27Z</dc:date>
    </item>
  </channel>
</rss>

