<?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: How to extract text data from a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451052#M113653</link>
    <description>&lt;P&gt;HI!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your text is in a variable called "text", then this would work --&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want = scan(scan(text,2,'-'),1,'.') ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Claes&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2018 12:19:11 GMT</pubDate>
    <dc:creator>Clash</dc:creator>
    <dc:date>2018-04-04T12:19:11Z</dc:date>
    <item>
      <title>How to extract text data from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451029#M113640</link>
      <description>&lt;P&gt;I have below text data&lt;/P&gt;
&lt;P&gt;"If&amp;nbsp; IsEqualTo Inclusion 1 then... set datapoint value for ILIST in Inclusion Criteria to&amp;nbsp;LIST #1 - The subject is a boy or girl, aged ≥7 and &amp;lt;12years (patients who turn 12 years during the study will be allowed to continue in the game)., and execute the ""Return True"" custom function".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this text i need to extract "&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;subject&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;is a boy or girl, aged ≥7 and &amp;lt;12years&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;(patients who turn 12&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;years during the study will be allowed to continue in the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;game&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;"&amp;nbsp; i.e whenever it starts with "-" and ends with ".," then i need the text in between.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 11:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451029#M113640</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2018-04-04T11:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract text data from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451045#M113648</link>
      <description>&lt;P&gt;If your logic is acurate then that is simple:&lt;/P&gt;
&lt;PRE&gt;/* Gets all text from - */
inter=substr(have,index(have,"-"));
/* gets all text up to . */
want=substr(inter,1,index(inter,"."));
&lt;/PRE&gt;
&lt;P&gt;Assumes both are present etc.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451045#M113648</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-04T12:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract text data from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451052#M113653</link>
      <description>&lt;P&gt;HI!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If your text is in a variable called "text", then this would work --&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want = scan(scan(text,2,'-'),1,'.') ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Claes&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451052#M113653</guid>
      <dc:creator>Clash</dc:creator>
      <dc:date>2018-04-04T12:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract text data from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451082#M113662</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A solution with a regexp :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    string='If  IsEqualTo Inclusion 1 then... set datapoint value for ILIST in Inclusion Criteria to LIST #1 - The subject is a boy or girl, aged ≥7 and &amp;lt;12years (patients who turn 12 years during the study will be allowed to continue in the game)., and execute the ""Return True"" custom function';
    extract=prxchange("s/.*-(.*)\..*/$1/",1,string);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-text-data-from-a-variable/m-p/451082#M113662</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-04-04T12:58:54Z</dc:date>
    </item>
  </channel>
</rss>

