<?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 individual sentences in a paragraph into separate columns using SAS arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913751#M360122</link>
    <description>&lt;P&gt;Hi, I would like to create separate columns (Line1 to LineN) to split individual sentences in a paragraph (column name is Comments) using SAS arrays. This is how I envisioned it to be:&lt;/P&gt;&lt;P&gt;Comment:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Traffic data for South Entrance is estimated. Traffic counter was inoperable from December 1-7 due to new counter installation. Estimated data generated by taking daily average from December 8-31...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Line1:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Traffic data for South Entrance is estimated.&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Line2:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Traffic counter was inoperable from December 1-7 due to new counter installation.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Line3:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Estimated data generated by taking daily average from December 8-31...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the code below, I was able to identify that the maximum number of sentences there is in a Comment value is 17. I assume this will be the dimension for my array (?)&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select max(NumSentences) into :max_cnt trimmed&lt;BR /&gt;from work.SouthRim;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;=max_cnt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am thinking of using count, find and substr functions but do not know how and where to start. Can you please help me? Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 31 Jan 2024 11:04:33 GMT</pubDate>
    <dc:creator>jatxn</dc:creator>
    <dc:date>2024-01-31T11:04:33Z</dc:date>
    <item>
      <title>Split individual sentences in a paragraph into separate columns using SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913751#M360122</link>
      <description>&lt;P&gt;Hi, I would like to create separate columns (Line1 to LineN) to split individual sentences in a paragraph (column name is Comments) using SAS arrays. This is how I envisioned it to be:&lt;/P&gt;&lt;P&gt;Comment:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Traffic data for South Entrance is estimated. Traffic counter was inoperable from December 1-7 due to new counter installation. Estimated data generated by taking daily average from December 8-31...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Line1:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Traffic data for South Entrance is estimated.&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Line2:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Traffic counter was inoperable from December 1-7 due to new counter installation.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Line3:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Estimated data generated by taking daily average from December 8-31...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the code below, I was able to identify that the maximum number of sentences there is in a Comment value is 17. I assume this will be the dimension for my array (?)&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select max(NumSentences) into :max_cnt trimmed&lt;BR /&gt;from work.SouthRim;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;=max_cnt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am thinking of using count, find and substr functions but do not know how and where to start. Can you please help me? Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 31 Jan 2024 11:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913751#M360122</guid>
      <dc:creator>jatxn</dc:creator>
      <dc:date>2024-01-31T11:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Split individual sentences in a paragraph into separate columns using SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913755#M360125</link>
      <description>&lt;P&gt;How would you identify a sentence? Does the sentence end with a period, or can it end with a question mark or exclamation point or emoji? How many sentences are in this example text:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;I went to visit Dr. Jones on Feb. 22, 2023&lt;/PRE&gt;
&lt;P&gt;Why does the solution have to use an array (which seems to me to be particularly un-useful in this case)? If a solution was available without arrays, would that work?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 11:15:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913755#M360125</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-31T11:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Split individual sentences in a paragraph into separate columns using SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913765#M360131</link>
      <description>&lt;P&gt;Hi, for this case study, a sentence ends with a period only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution doesn't have to be using arrays - it's just the first thing that came to my mind when I thought of a solution. Any approach is welcome! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 12:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913765#M360131</guid>
      <dc:creator>jatxn</dc:creator>
      <dc:date>2024-01-31T12:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Split individual sentences in a paragraph into separate columns using SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913782#M360133</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
text='Traffic data for South Entrance is estimated. Traffic counter was inoperable from December 1-7 due to new counter installation. Estimated data generated by taking daily average from December 8-31...';
run;

data want;
    set have;
    length word $ 1024;
    word='AAA';
    i=0;
    do while(not missing(word));
        i=i+1;
        word=cats(scan(text,i,'.'));
        if not missing(word) then output;
	end;
    drop i text;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Despite the fact that your subject line asks for separate columns, the example you give produces separate rows, so that's what I did.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: if any approach will work, do not specify to use arrays, or to use any other SAS technique&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 13:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-individual-sentences-in-a-paragraph-into-separate-columns/m-p/913782#M360133</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-31T13:35:40Z</dc:date>
    </item>
  </channel>
</rss>

