<?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: Conditional Logic with Multiple Conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788189#M251948</link>
    <description>&lt;P&gt;Without actual data it is hard to confirm though I might suggest an additional else so if the value is set with the first comparison you do not reset it with the following comparisons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;DATA Aim1;
	SET Variables;
IF prxmatch("/COV/",CauseofDeath)  THEN COVDeathsBiobank=1;
&lt;U&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/U&gt; IF ContributingFactorsofDeath= "U07.1" THEN COVDeathsBiobank=1;
	ELSE     COVDeathsBiobank=0;
RUN;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jan 2022 21:53:21 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-01-03T21:53:21Z</dc:date>
    <item>
      <title>Conditional Logic with Multiple Conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788183#M251947</link>
      <description>&lt;P&gt;I want to use two variables in my data set (CauseofDeath and&amp;nbsp;ContributingFactorsofDeath) to create a new variable:&amp;nbsp;COVDeathsBiobank&lt;/P&gt;&lt;P&gt;I'm not sure I'm translating this correctly into code. Here is what I am trying to do in words:&lt;/P&gt;&lt;P&gt;If the CauseofDeath contains the string "COV" AND/OR if ContributingFactorsofDeath=U07.1,&lt;/P&gt;&lt;P&gt;then COVDeathsBiobank=1&lt;/P&gt;&lt;P&gt;If both of these statements are false I wanted COVDeathsBiobank=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are some observations with just the first condition true, some with just the second condition true, and some with both true. Here is what I have:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA Aim1;
	SET Variables;
IF prxmatch("/COV/",CauseofDeath)  THEN COVDeathsBiobank=1;
IF ContributingFactorsofDeath= "U07.1" THEN COVDeathsBiobank=1;
	ELSE     COVDeathsBiobank=0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm trying to make sure I don't accidentally exclude observations that for example meet the second criteria but are coded as 0 in COVDeathsBiobank because the first criteria is false. Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 21:30:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788183#M251947</guid>
      <dc:creator>abrice520</dc:creator>
      <dc:date>2022-01-03T21:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Logic with Multiple Conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788189#M251948</link>
      <description>&lt;P&gt;Without actual data it is hard to confirm though I might suggest an additional else so if the value is set with the first comparison you do not reset it with the following comparisons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;DATA Aim1;
	SET Variables;
IF prxmatch("/COV/",CauseofDeath)  THEN COVDeathsBiobank=1;
&lt;U&gt;&lt;FONT color="#800080"&gt;&lt;STRONG&gt;ELSE&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/U&gt; IF ContributingFactorsofDeath= "U07.1" THEN COVDeathsBiobank=1;
	ELSE     COVDeathsBiobank=0;
RUN;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 21:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788189#M251948</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-03T21:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Logic with Multiple Conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788193#M251949</link>
      <description>Thank you this was exactly what I needed!</description>
      <pubDate>Mon, 03 Jan 2022 22:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conditional-Logic-with-Multiple-Conditions/m-p/788193#M251949</guid>
      <dc:creator>abrice520</dc:creator>
      <dc:date>2022-01-03T22:08:13Z</dc:date>
    </item>
  </channel>
</rss>

