<?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: extracting based on the first word in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738410#M230343</link>
    <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 02 May 2021 16:10:01 GMT</pubDate>
    <dc:creator>lillymaginta1</dc:creator>
    <dc:date>2021-05-02T16:10:01Z</dc:date>
    <item>
      <title>extracting based on the first word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738407#M230341</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data have;
infile cards ;
input ID   drugname ;	 
cards;
001 sodium oral benzoate 
002 oral sodium 
003 oral potassium 
004 oral Sodium 
005 Sodium oral
;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hi everyone,&lt;/P&gt;
&lt;P&gt;I am trying to extract records that start with the word "oral" only at the beginning.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output&amp;nbsp;&lt;/P&gt;
&lt;P&gt;001 0&lt;/P&gt;
&lt;P&gt;002 1&lt;/P&gt;
&lt;P&gt;003 1&lt;/P&gt;
&lt;P&gt;004 1&lt;/P&gt;
&lt;P&gt;005 0&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 15:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738407#M230341</guid>
      <dc:creator>lillymaginta1</dc:creator>
      <dc:date>2021-05-02T15:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: extracting based on the first word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738408#M230342</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Your data step is not working ;-).&lt;/P&gt;
&lt;P&gt;Here's the code you are after:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
LENGTH drugname $ 20;
infile cards delimiter='|';
input ID $ drugname $ ;	 
cards;
001 |sodium oral benzoate 
002 |oral sodium 
003 |oral potassium 
004 |oral Sodium 
005 |Sodium oral
;
run;

data want;
 set have;
 if upcase(scan(drugname,1,' '))='ORAL' then indicator=1;
 else indicator=0;
run;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 16:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738408#M230342</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-05-02T16:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: extracting based on the first word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738410#M230343</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 16:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738410#M230343</guid>
      <dc:creator>lillymaginta1</dc:creator>
      <dc:date>2021-05-02T16:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: extracting based on the first word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738543#M230398</link>
      <description>&lt;BR /&gt;data want;&lt;BR /&gt; set have;&lt;BR /&gt; if upcase(drugname)=:'ORAL' then indicator=1;&lt;BR /&gt; else indicator=0;&lt;BR /&gt;run;</description>
      <pubDate>Mon, 03 May 2021 11:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/extracting-based-on-the-first-word/m-p/738543#M230398</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-05-03T11:05:48Z</dc:date>
    </item>
  </channel>
</rss>

