<?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: Case When for Multiple Values in a Group in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556523#M33641</link>
    <description>&lt;P&gt;Here's the code I used to create the test data, and the code that is generated by the EG query builder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
	input InNum;
	cards;
111
222
333
444
555
666
777
888
999
run;

PROC SQL;
   CREATE TABLE WORK.QUERY_FOR_HAVE AS 
   SELECT t1.InNum, 
          /* OutNum */
            (CASE
               WHEN (InNum in(111,333,555))
               THEN "ABC"
               WHEN (InNum in(222, 888))
               THEN "DEF"
               ELSE "GHI"
            END) AS OutNum
      FROM WORK.HAVE t1;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 May 2019 18:42:52 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2019-05-06T18:42:52Z</dc:date>
    <item>
      <title>Case When for Multiple Values in a Group</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556492#M33639</link>
      <description>&lt;P&gt;This seems like it would be simple, but I have had no luck making it work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a set of numbers representing account numbers.&amp;nbsp; I need to assign each number to one of&amp;nbsp; three groups.&amp;nbsp; For simplicity, let's use numbers:&lt;/P&gt;&lt;P&gt;111&lt;/P&gt;&lt;P&gt;222&lt;/P&gt;&lt;P&gt;333&lt;/P&gt;&lt;P&gt;444&lt;/P&gt;&lt;P&gt;555&lt;/P&gt;&lt;P&gt;666&lt;/P&gt;&lt;P&gt;777&lt;/P&gt;&lt;P&gt;888&lt;/P&gt;&lt;P&gt;999&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The groups will belong to ABC, DEF or GHI.&amp;nbsp; The group names are not in the dataset.&amp;nbsp; How/can I write this using 1 next CASE/WHEN statement?&amp;nbsp; If so, how?&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 17:09:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556492#M33639</guid>
      <dc:creator>arjessup</dc:creator>
      <dc:date>2019-05-06T17:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Case When for Multiple Values in a Group</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556495#M33640</link>
      <description>Are there any rules for assigning to groups? What happens if you have a number of groups that's not divisible by 3, ie if you have 10 account numbers.</description>
      <pubDate>Mon, 06 May 2019 17:16:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556495#M33640</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-06T17:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Case When for Multiple Values in a Group</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556523#M33641</link>
      <description>&lt;P&gt;Here's the code I used to create the test data, and the code that is generated by the EG query builder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
	input InNum;
	cards;
111
222
333
444
555
666
777
888
999
run;

PROC SQL;
   CREATE TABLE WORK.QUERY_FOR_HAVE AS 
   SELECT t1.InNum, 
          /* OutNum */
            (CASE
               WHEN (InNum in(111,333,555))
               THEN "ABC"
               WHEN (InNum in(222, 888))
               THEN "DEF"
               ELSE "GHI"
            END) AS OutNum
      FROM WORK.HAVE t1;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 18:42:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556523#M33641</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-05-06T18:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Case When for Multiple Values in a Group</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556814#M33648</link>
      <description>&lt;P&gt;No, the groups have various numbers of accounts.&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 15:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556814#M33648</guid>
      <dc:creator>arjessup</dc:creator>
      <dc:date>2019-05-07T15:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Case When for Multiple Values in a Group</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556816#M33649</link>
      <description>&lt;P&gt;Thank you Tom.&amp;nbsp; I was way over complicating the issue.&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2019 15:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Case-When-for-Multiple-Values-in-a-Group/m-p/556816#M33649</guid>
      <dc:creator>arjessup</dc:creator>
      <dc:date>2019-05-07T15:35:14Z</dc:date>
    </item>
  </channel>
</rss>

