<?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: Using Or in a case statement in proc sql in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756855#M239035</link>
    <description>&lt;P&gt;Also&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;as 'new stata'&lt;BR /&gt;&lt;BR /&gt;should be&lt;BR /&gt;&lt;BR /&gt;as 'new strata'&lt;FONT color="#FF0000"&gt;n&lt;/FONT&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Jul 2021 03:44:46 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2021-07-27T03:44:46Z</dc:date>
    <item>
      <title>Using Or in a case statement in proc sql in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756820#M239013</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I need to use or statement in a case statement. It keeps giving me errors:&lt;/P&gt;
&lt;PRE&gt;Proc sql;
create table mytable as;

select a.*, b* ,
case when (a.diagcode1 &amp;lt;150  and a.diagcode2 &amp;lt;12) then 'no more'
case when missing(a.diagcode) or missing(a.diacode2) then 'non existent'
else ' '
end as 'new stata'
from a Left join b...



&lt;/PRE&gt;
&lt;P&gt;what is the problem?&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;blueblue&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 21:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756820#M239013</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2021-07-26T21:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Or in a case statement in proc sql in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756823#M239016</link>
      <description>&lt;P&gt;Try this - but please remember to post your SAS log including errors as we aren't mind readers&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
create table mytable as

select a.*, b* ,
case &lt;BR /&gt;  when (a.diagcode1 &amp;lt;150  and a.diagcode2 &amp;lt;12) then 'no more'
  when missing(a.diagcode) or missing(a.diacode2) then 'non existent'
else ' '
end as new_stata
from a Left join b...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Jul 2021 22:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756823#M239016</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-07-26T22:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using Or in a case statement in proc sql in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756825#M239018</link>
      <description>1. Too many CASE (twice, should only be once) One CASE per new variable being created. &lt;BR /&gt;2. Too early semicolon - no semicolon after the AS on the CREATE TABLE clause&lt;BR /&gt;3. Order of operations. SAS puts numeric missing as the lowest values so if you first check if the values are &amp;lt; 12 and 150 and both are missing you'll get them coded into "no more" when it should be in non existent. &lt;BR /&gt;&lt;BR /&gt;Those are for starters...there could be more.</description>
      <pubDate>Mon, 26 Jul 2021 22:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756825#M239018</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-26T22:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using Or in a case statement in proc sql in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756828#M239021</link>
      <description>And if there are errors in your code include them in the post.</description>
      <pubDate>Mon, 26 Jul 2021 22:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756828#M239021</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-26T22:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using Or in a case statement in proc sql in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756855#M239035</link>
      <description>&lt;P&gt;Also&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;as 'new stata'&lt;BR /&gt;&lt;BR /&gt;should be&lt;BR /&gt;&lt;BR /&gt;as 'new strata'&lt;FONT color="#FF0000"&gt;n&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Jul 2021 03:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Or-in-a-case-statement-in-proc-sql-in-SAS/m-p/756855#M239035</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-07-27T03:44:46Z</dc:date>
    </item>
  </channel>
</rss>

