<?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 if not, else if proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610372#M177745</link>
    <description>&lt;P&gt;I have the current sas code that works fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA td.data_new
set td.data;
if not missing(A) then Points = 250;
else if B &amp;gt;= 10 and C= 0 then Points = 230;
else if D &amp;lt;6 and E &amp;gt;60 then Points = 150;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I want to convert this to some equivalent SQL code, so that I can use it in a proc sql statement. Any help would be appreciated, thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2019 05:42:15 GMT</pubDate>
    <dc:creator>sasprogramming</dc:creator>
    <dc:date>2019-12-09T05:42:15Z</dc:date>
    <item>
      <title>if not, else if proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610372#M177745</link>
      <description>&lt;P&gt;I have the current sas code that works fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA td.data_new
set td.data;
if not missing(A) then Points = 250;
else if B &amp;gt;= 10 and C= 0 then Points = 230;
else if D &amp;lt;6 and E &amp;gt;60 then Points = 150;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I want to convert this to some equivalent SQL code, so that I can use it in a proc sql statement. Any help would be appreciated, thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 05:42:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610372#M177745</guid>
      <dc:creator>sasprogramming</dc:creator>
      <dc:date>2019-12-09T05:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: if not, else if proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610374#M177746</link>
      <description>&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table td.data_new as select a,b,c,d,e, case when a ne . then 250 else when b&amp;gt;=10 and c=0 then 230, else when d&amp;lt;6 and e&amp;gt;60 then 150 else . end as points from td.data;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Dec 2019 06:03:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610374#M177746</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-12-09T06:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: if not, else if proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610575#M177816</link>
      <description>&lt;P&gt;Thank you but I am receiving this error?&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, (, *, **, +, -, '.', /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, AND, EQ, EQT,&lt;/DIV&gt;&lt;DIV class="sasError"&gt;GE, GET, GT, GTT, LE, LET, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Dec 2019 22:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/610575#M177816</guid>
      <dc:creator>sasprogramming</dc:creator>
      <dc:date>2019-12-09T22:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: if not, else if proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/611119#M178056</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/302184"&gt;@sasprogramming&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to mention "ELSE" only once at the end and remove commas.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table data_new as
	select a,b,c,d,e,
	case when a ne . then 250
		 when b&amp;gt;=10 and c=0 then 230
		 when d&amp;lt;6 and e&amp;gt;60 then 150
		 else . end as points
	from data;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 20:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-not-else-if-proc-sql/m-p/611119#M178056</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-11T20:05:33Z</dc:date>
    </item>
  </channel>
</rss>

