<?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 Recoding  variable with contains instruction in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447347#M112359</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I wish to create a new variable Newcode using conditions and "Contains" instruction.&lt;/P&gt;&lt;P&gt;Considering the example here attached&amp;nbsp; the variable Newcode has to satisfy this condition :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (ateco81='830' or&amp;nbsp;&lt;SPAN&gt;ateco81='982') and (ateco91='93020' or&amp;nbsp;ateco91='93021') and (attsoc contains "PArrucch*" or "Barbier*")) then Newcode ='999';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Obviously this instruction doesn't work. Can you give me any suggestion?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Stefania&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Version SAS 9.4&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 08:47:09 GMT</pubDate>
    <dc:creator>Stefy67</dc:creator>
    <dc:date>2018-03-21T08:47:09Z</dc:date>
    <item>
      <title>Recoding  variable with contains instruction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447347#M112359</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I wish to create a new variable Newcode using conditions and "Contains" instruction.&lt;/P&gt;&lt;P&gt;Considering the example here attached&amp;nbsp; the variable Newcode has to satisfy this condition :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (ateco81='830' or&amp;nbsp;&lt;SPAN&gt;ateco81='982') and (ateco91='93020' or&amp;nbsp;ateco91='93021') and (attsoc contains "PArrucch*" or "Barbier*")) then Newcode ='999';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Obviously this instruction doesn't work. Can you give me any suggestion?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Stefania&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Version SAS 9.4&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 08:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447347#M112359</guid>
      <dc:creator>Stefy67</dc:creator>
      <dc:date>2018-03-21T08:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding  variable with contains instruction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447348#M112360</link>
      <description>&lt;P&gt;As usual there is more than one way to do this. The quickest would be to use the FIND function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if find(string, substr) &amp;gt; 0 then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatives are the INDEX function and Perl Regular Expressions (PRX) functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Jan.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 08:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447348#M112360</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2018-03-21T08:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding  variable with contains instruction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447356#M112363</link>
      <description>&lt;P&gt;Please supply code as advised in &lt;A href="https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce" target="_blank"&gt;https://communities.sas.com/t5/help/faqpage/faq-category-id/posting?nobounce&lt;/A&gt;, and example data in data steps with datalines (a macro for converting your data to data steps is found in &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;Posting Excel files automatically reduces the number of potential helpers, as many of us won't (or even can't, by organizational policies) download MS Office files from the web.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 10:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447356#M112363</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-21T10:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Recoding  variable with contains instruction</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447417#M112389</link>
      <description>Thanks I find the solution.&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Mar 2018 14:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Recoding-variable-with-contains-instruction/m-p/447417#M112389</guid>
      <dc:creator>Stefy67</dc:creator>
      <dc:date>2018-03-21T14:01:52Z</dc:date>
    </item>
  </channel>
</rss>

