<?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: Coding various if statements in SAS in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Coding-various-if-statements-in-SAS/m-p/721874#M38242</link>
    <description>&lt;P&gt;In fact, you have only 5 "combinations":&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;no match&lt;/LI&gt;
&lt;LI&gt;A=B&lt;/LI&gt;
&lt;LI&gt;A=C&lt;/LI&gt;
&lt;LI&gt;B=C&lt;/LI&gt;
&lt;LI&gt;A=B=C&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;So my code would look like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if a = b and b = c then result = "all match";
else if a = b then result = "A=B";
else if a = c then result = "A=C";
else if b = c then result = "B=C";
else result = "no match";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 25 Feb 2021 14:14:30 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-02-25T14:14:30Z</dc:date>
    <item>
      <title>Coding various if statements in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Coding-various-if-statements-in-SAS/m-p/721866#M38241</link>
      <description>&lt;P&gt;Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have three numeric variables which range from 0 to n and I would like to compare if they match across records and if not which way to they disagree.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The name my variables are A , B and C. I've drawn the logic out in a 3 way Venn Diagram but I'm trying to write a if clause in SAS to extract out the information. I have 7 combinations in total.&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;A=B&lt;/P&gt;&lt;P&gt;A=C&lt;/P&gt;&lt;P&gt;B=C&lt;/P&gt;&lt;P&gt;A=B=C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to have something written such as; if A=B=C then Cohort='ABC'&lt;/P&gt;&lt;P&gt;if A=B then Cohort='AB' and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this would be great.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2021 14:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Coding-various-if-statements-in-SAS/m-p/721866#M38241</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2021-02-25T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Coding various if statements in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Coding-various-if-statements-in-SAS/m-p/721874#M38242</link>
      <description>&lt;P&gt;In fact, you have only 5 "combinations":&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;no match&lt;/LI&gt;
&lt;LI&gt;A=B&lt;/LI&gt;
&lt;LI&gt;A=C&lt;/LI&gt;
&lt;LI&gt;B=C&lt;/LI&gt;
&lt;LI&gt;A=B=C&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;So my code would look like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
if a = b and b = c then result = "all match";
else if a = b then result = "A=B";
else if a = c then result = "A=C";
else if b = c then result = "B=C";
else result = "no match";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Feb 2021 14:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Coding-various-if-statements-in-SAS/m-p/721874#M38242</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-25T14:14:30Z</dc:date>
    </item>
  </channel>
</rss>

