<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280784#M56802</link>
    <description>&lt;P&gt;Case statements don't work that way. You'll need a case statement for each variable you want to create.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can use a data step that is possible.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2016 13:58:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-06-28T13:58:51Z</dc:date>
    <item>
      <title>Case when</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280776#M56796</link>
      <description>&lt;P&gt;I have written this code but get an error, any idea why please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table work.score_2 as &lt;BR /&gt;select&lt;BR /&gt;*,&lt;BR /&gt;case &lt;BR /&gt;when no_of_applicants = 1 then app1_employment_status_code = 'E'&lt;BR /&gt;when no_of_applicants &amp;gt; 1 then app2_employment_status_code = 'E'&lt;BR /&gt;else 'null'&lt;BR /&gt;end as employment&lt;/P&gt;
&lt;P&gt;from &lt;BR /&gt;work.score_1;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: Result of WHEN clause 3 is not the same data type as the preceding results.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280776#M56796</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-06-28T13:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Case when</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280781#M56799</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the correct syntax shall be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table work.score_2 as
select
*,
case
when no_of_applicants = 1 then  'E'
when no_of_applicants &amp;gt; 1 then  'E'
else 'null'
end as employment

from
work.score_1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280781#M56799</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2016-06-28T13:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Case when</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280782#M56800</link>
      <description>&lt;P&gt;Maybe I am asking for the wrong thing as surely that will just assign an E on the no_of_applicants rather than look up to 2 seperate variables? So on&amp;nbsp;app1_employment_status_code you can have 'S' 'R' 'U' or 'E' but that code won't pick any of those up will it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want it that&lt;/P&gt;
&lt;P&gt;if&amp;nbsp;no_of_applicants = 1 then&amp;nbsp;app&lt;STRONG&gt;1&lt;/STRONG&gt;_employment_status_code = E&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if&amp;nbsp;no_of_applicants &amp;gt; 1 then&amp;nbsp;app&lt;/SPAN&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;SPAN&gt;_employment_status_code = E&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280782#M56800</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2016-06-28T13:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Case when</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280784#M56802</link>
      <description>&lt;P&gt;Case statements don't work that way. You'll need a case statement for each variable you want to create.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can use a data step that is possible.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 13:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/280784#M56802</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-28T13:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Case when</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/281068#M56923</link>
      <description>&lt;P&gt;SQl works best with normalized data. Havin columns named app&lt;EM&gt;N&lt;/EM&gt; etc isn't normalized.&lt;/P&gt;
&lt;P&gt;Are you building an analytical base table?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2016 12:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Case-when/m-p/281068#M56923</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-29T12:44:51Z</dc:date>
    </item>
  </channel>
</rss>

