<?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 WHEN clause with multiple conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577957#M163850</link>
    <description>&lt;P&gt;Hi all I'm new to SAS and I'm just wondering why I am getting the error below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff6600"&gt;ERROR: Result of WHEN clause 3 is not the same data type as the preceding results&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;Here is my code&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;WHEN Year = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1617&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; and state in (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'NSW'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) and Surgical_Specialty = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'12'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; then Surgical_Specialty = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'11'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;WHEN Year = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1617&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; and t1.state in (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'NT'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) and Surgical_Specialty in (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'01'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) then Surgical_Specialty&lt;/FONT&gt; &lt;FONT face="Courier New" size="3"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'11'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;ELSE Surgical_Specialty end as Surgical_Specialty,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Year column is in Numeric&lt;/P&gt;&lt;P&gt;The Surgical_Specialty and STATE&amp;nbsp;is in Character&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure why I cannot use year and STATE and surgical specialty in one when statement&lt;/P&gt;&lt;P&gt;Thankyou&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 06:44:06 GMT</pubDate>
    <dc:creator>kenjichan1212</dc:creator>
    <dc:date>2019-07-31T06:44:06Z</dc:date>
    <item>
      <title>WHEN clause with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577957#M163850</link>
      <description>&lt;P&gt;Hi all I'm new to SAS and I'm just wondering why I am getting the error below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff6600"&gt;ERROR: Result of WHEN clause 3 is not the same data type as the preceding results&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333"&gt;Here is my code&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;case&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;WHEN Year = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1617&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; and state in (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'NSW'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) and Surgical_Specialty = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'12'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; then Surgical_Specialty = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'11'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;WHEN Year = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1617&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; and t1.state in (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'NT'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) and Surgical_Specialty in (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'01'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'1'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;) then Surgical_Specialty&lt;/FONT&gt; &lt;FONT face="Courier New" size="3"&gt;= &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'11'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;ELSE Surgical_Specialty end as Surgical_Specialty,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Year column is in Numeric&lt;/P&gt;&lt;P&gt;The Surgical_Specialty and STATE&amp;nbsp;is in Character&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure why I cannot use year and STATE and surgical specialty in one when statement&lt;/P&gt;&lt;P&gt;Thankyou&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 06:44:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577957#M163850</guid>
      <dc:creator>kenjichan1212</dc:creator>
      <dc:date>2019-07-31T06:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: WHEN clause with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577962#M163854</link>
      <description>&lt;P&gt;Use the correct syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your 2 first when clauses return a Boolean (the result of the test &lt;FONT size="3" face="Courier New"&gt;Surgical_Specialty = &lt;/FONT&gt;&lt;FONT size="3" face="Courier New" color="#800080"&gt;'11'&lt;/FONT&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;CASE&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;WHEN Year = &lt;STRONG&gt;&lt;FONT color="#008080"&gt;1617&lt;/FONT&gt;&lt;/STRONG&gt; and state in (&lt;FONT color="#800080"&gt;'NSW'&lt;/FONT&gt;) and Surgical_Specialty = &lt;FONT color="#800080"&gt;'12'&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then &lt;FONT color="#800080"&gt;'11'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;WHEN Year = &lt;STRONG&gt;&lt;FONT color="#008080"&gt;1617&lt;/FONT&gt;&lt;/STRONG&gt; and state in (&lt;FONT color="#800080"&gt;'NT '&lt;/FONT&gt;) and Surgical_Specialty in (&lt;FONT color="#800080"&gt;'01'&lt;/FONT&gt;,&lt;FONT color="#800080"&gt;'1'&lt;/FONT&gt;) then &lt;FONT color="#800080"&gt;'11'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" face="courier new,courier"&gt;ELSE Surgical_Specialty END as Surgical_Specialty&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 06:50:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577962#M163854</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-07-31T06:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: WHEN clause with multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577963#M163855</link>
      <description>&lt;P&gt;Thank you so mcuh!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 06:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHEN-clause-with-multiple-conditions/m-p/577963#M163855</guid>
      <dc:creator>kenjichan1212</dc:creator>
      <dc:date>2019-07-31T06:54:42Z</dc:date>
    </item>
  </channel>
</rss>

