<?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 Item description contains &amp;quot;Flatbread&amp;quot; then Item_type column equals 'Sandwich' in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556212#M9778</link>
    <description>&lt;P&gt;I am working with a sandwich shop's dataset and need to look within the Description column for the word 'Flatbread'. If the description contains flatbread, then I want the Item_Type column to return the value 'Sandwich'. There are over 500 items, and want it to look through all of the observations where Item_Type is blank for the word Flatbread. I have tried to do a findw command, and a contains command to get it to work - to no prevail. Any help would be greatly appreciated, I need to present my analysis very soon, so any prompt replies will be greatly appreciated. Thank you!&lt;/P&gt;</description>
    <pubDate>Sat, 04 May 2019 19:36:37 GMT</pubDate>
    <dc:creator>Yosef20</dc:creator>
    <dc:date>2019-05-04T19:36:37Z</dc:date>
    <item>
      <title>Item description contains "Flatbread" then Item_type column equals 'Sandwich'</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556212#M9778</link>
      <description>&lt;P&gt;I am working with a sandwich shop's dataset and need to look within the Description column for the word 'Flatbread'. If the description contains flatbread, then I want the Item_Type column to return the value 'Sandwich'. There are over 500 items, and want it to look through all of the observations where Item_Type is blank for the word Flatbread. I have tried to do a findw command, and a contains command to get it to work - to no prevail. Any help would be greatly appreciated, I need to present my analysis very soon, so any prompt replies will be greatly appreciated. Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 19:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556212#M9778</guid>
      <dc:creator>Yosef20</dc:creator>
      <dc:date>2019-05-04T19:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Item description contains "Flatbread" then Item_type column equals 'Sandwich'</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556219#M9779</link>
      <description>&lt;P&gt;FINDW() is the correct approach. Please post your code that doesn't work and we can see where it's wrong or if there's something else that needs to be factored in. Note that searches for character values are case sensitive.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It also helps if you can post sample data, since your data structure since that may define how things need to be coded.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272890"&gt;@Yosef20&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am working with a sandwich shop's dataset and need to look within the Description column for the word 'Flatbread'. If the description contains flatbread, then I want the Item_Type column to return the value 'Sandwich'. There are over 500 items, and want it to look through all of the observations where Item_Type is blank for the word Flatbread. I have tried to do a findw command, and a contains command to get it to work - to no prevail. Any help would be greatly appreciated, I need to present my analysis very soon, so any prompt replies will be greatly appreciated. Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 21:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556219#M9779</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-04T21:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Item description contains "Flatbread" then Item_type column equals 'Sandwich'</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556267#M9791</link>
      <description>&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;What dataset looks like now:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;ItemNumber&amp;nbsp; &amp;nbsp; &amp;nbsp;Description&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ItemType&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Double Flatbread&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;lt;blank&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;with chicken&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Regular Bacon ...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; Sandwich&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Regular Turkey/Ham&amp;nbsp; | Sandwich&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;- There are also ItemTypes such as salads, chips, cookies, add ons etc. but I am only testing sandwiches right now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Example of what output dataset should look like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;ItemNumber&amp;nbsp; &amp;nbsp; &amp;nbsp;Description&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ItemType&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Double Flatbread&amp;nbsp; &amp;nbsp; &amp;nbsp;Sandwich&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;with chicken&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;etc.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Test Code (doesn't work):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;DATA Work.TestData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SET Work.TestData;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IF Item_Type = '' then DO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IF FINDW(Description, 'Flatbread')&amp;gt;0 then Item_Type = 'Sandwich';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;The last forum I found the FINDW command was not very helpful in explaining the structure of it so I don't know if I even started doing it correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Thank you for the help, if there is more code or data that you need to see I can get it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 May 2019 15:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556267#M9791</guid>
      <dc:creator>Yosef20</dc:creator>
      <dc:date>2019-05-05T15:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Item description contains "Flatbread" then Item_type column equals 'Sandwich'</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556446#M9823</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Work.TestData2; *do not use the same name in DATA and SET statements. This makes it very hard to debug;

     SET Work.TestData;

           IF missing(ItemType) and FINDW(Description, 'Flatbread', 'i')&amp;gt;0 then ItemType = 'Sandwich';


RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Try this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note a few changes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Item_TYPE to ItemTYpe - you seem to be using both but your data shows ITemType, not underscore. If this was the case the log would likely have an error about uninitialized variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Replace testDATA in DATA statement (first line) so that it's easier to debug the code&lt;/P&gt;
&lt;P&gt;3. Remove IF/THEN since not needed&lt;/P&gt;
&lt;P&gt;4. Added 'i' modifier to FIND to allow it to ignore the case of the world flatbread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this works and if it doesn't post the full log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Documentation on the FIND function is here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p16rdsa30vmm43n1ej4936nwa01t.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p16rdsa30vmm43n1ej4936nwa01t.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272890"&gt;@Yosef20&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;What dataset looks like now:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;ItemNumber&amp;nbsp; &amp;nbsp; &amp;nbsp;Description&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ItemType&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Double Flatbread&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; &amp;lt;blank&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;with chicken&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Regular Bacon ...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; Sandwich&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Regular Turkey/Ham&amp;nbsp; | Sandwich&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;- There are also ItemTypes such as salads, chips, cookies, add ons etc. but I am only testing sandwiches right now.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Example of what output dataset should look like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;ItemNumber&amp;nbsp; &amp;nbsp; &amp;nbsp;Description&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ItemType&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Double Flatbread&amp;nbsp; &amp;nbsp; &amp;nbsp;Sandwich&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;with chicken&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;etc.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Test Code (doesn't work):&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;DATA Work.TestData;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SET Work.TestData;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IF Item_Type = '' then DO;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IF FINDW(Description, 'Flatbread')&amp;gt;0 then Item_Type = 'Sandwich';&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;END;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;The last forum I found the FINDW command was not very helpful in explaining the structure of it so I don't know if I even started doing it correctly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Thank you for the help, if there is more code or data that you need to see I can get it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 14:49:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Item-description-contains-quot-Flatbread-quot-then-Item-type/m-p/556446#M9823</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-06T14:49:42Z</dc:date>
    </item>
  </channel>
</rss>

