<?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: Split up text in one line to several lines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45381#M9377</link>
    <description>Thanks a lot!</description>
    <pubDate>Wed, 06 Apr 2011 17:02:36 GMT</pubDate>
    <dc:creator>Valentin_HU</dc:creator>
    <dc:date>2011-04-06T17:02:36Z</dc:date>
    <item>
      <title>Split up text in one line to several lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45379#M9375</link>
      <description>Hey,&lt;BR /&gt;
&lt;BR /&gt;
I have the following problem: my data looks like:&lt;BR /&gt;
&lt;BR /&gt;
ident  |  text&lt;BR /&gt;
1    |     sentence1. sentence2. sentence3. (...)sentenceN.&lt;BR /&gt;
2    |    sentence1. sentence2. sentence3. (...)sentenceM.&lt;BR /&gt;
&lt;BR /&gt;
I want to transform it into:&lt;BR /&gt;
&lt;BR /&gt;
ident  |  text&lt;BR /&gt;
1     |    sentence1.&lt;BR /&gt;
1     |    sentence2.&lt;BR /&gt;
1     |    sentence3.&lt;BR /&gt;
(...)&lt;BR /&gt;
1     |    sentenceN.&lt;BR /&gt;
2     |    sentence1.&lt;BR /&gt;
2     |    sentence2.&lt;BR /&gt;
2     |    sentence3.&lt;BR /&gt;
(...)&lt;BR /&gt;
2     |    sentenceM.&lt;BR /&gt;
&lt;BR /&gt;
Thus, the original variable text consists in each observation of a number of sentences which are delimited by a ".". Now, I want to create for each sentence a unique observation. Do you have an idea how to do this?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Valentin</description>
      <pubDate>Wed, 06 Apr 2011 15:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45379#M9375</guid>
      <dc:creator>Valentin_HU</dc:creator>
      <dc:date>2011-04-06T15:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Split up text in one line to several lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45380#M9376</link>
      <description>Hello Valentin,&lt;BR /&gt;
&lt;BR /&gt;
This is a solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
daia i;&lt;BR /&gt;
input ident 1-1 text $ 3-34;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 sentence1. sentence2. sentence3.&lt;BR /&gt;
2 sentence5. sentence6. sentence7.&lt;BR /&gt;
run;&lt;BR /&gt;
data r (rename=(t=text));  &lt;BR /&gt;
  set i;&lt;BR /&gt;
  length t $100.;&lt;BR /&gt;
  if first.ident then i=0;&lt;BR /&gt;
  do until (t=""); &lt;BR /&gt;
    i+1;&lt;BR /&gt;
    t=scan(text,i,".");&lt;BR /&gt;
    if t ne "" then output;&lt;BR /&gt;
  end;&lt;BR /&gt;
  by ident;&lt;BR /&gt;
  keep ident t;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 06 Apr 2011 16:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45380#M9376</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-04-06T16:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Split up text in one line to several lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45381#M9377</link>
      <description>Thanks a lot!</description>
      <pubDate>Wed, 06 Apr 2011 17:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45381#M9377</guid>
      <dc:creator>Valentin_HU</dc:creator>
      <dc:date>2011-04-06T17:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: Split up text in one line to several lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45382#M9378</link>
      <description>[pre]&lt;BR /&gt;
data i;&lt;BR /&gt;
input ident 1-1 text $ 3-34;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1 sentence1. sentence2. sentence3.&lt;BR /&gt;
2 sentence5. sentence6. sentence7.&lt;BR /&gt;
run;&lt;BR /&gt;
data temp;&lt;BR /&gt;
 set i;&lt;BR /&gt;
 i=1;&lt;BR /&gt;
 _text=scan(text,1,'.');&lt;BR /&gt;
 do while(not missing(_text));&lt;BR /&gt;
  output;&lt;BR /&gt;
  i+1;&lt;BR /&gt;
  _text=scan(text,i,'.');&lt;BR /&gt;
 end;&lt;BR /&gt;
 drop text i;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 07 Apr 2011 06:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Split-up-text-in-one-line-to-several-lines/m-p/45382#M9378</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-07T06:46:59Z</dc:date>
    </item>
  </channel>
</rss>

