<?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 syntax error in in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524669#M142698</link>
    <description>&lt;P&gt;I don't find any issue with the code, it works fine with my sample data. Make sure that the data types you defined are same in the source tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prodcd - Is this a character variable, if its numeric then you might need to give proccd=. (period) for numeric missing value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
set sashelp.class(keep=name height);
run;

data table2;
set sashelp.class(keep=name weight);
opendt='01JAN2018'd;
prodcd = ' ';
run;

proc sql;
create table abc as
select a.name, a.height, b.opendt,
case when today()-b.opendt&amp;gt;200 then b.opendt end as date_opened
from table1 a 
	left join table2 b
on a.name=b.name
where (a.height&amp;gt;50 and b.prodcd = ' ');
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jan 2019 19:26:32 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2019-01-04T19:26:32Z</dc:date>
    <item>
      <title>case when syntax error in</title>
      <link>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524649#M142686</link>
      <description>&lt;P&gt;I'm trying to run the simple query, but it's giving some syntax error. If I run it by removing the case when statement it runs fine which makes me feel the case when syntax is off. I have altered the table and variable names but apart from that the code is exact. I tried adding all sorts of brackets around the case statement but none of that seems to be working. Appreciate any help I can get. Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;

create table abc as

select a.name, a.height, b.opendt,

case when today()-b.opendt&amp;gt;200 then b.opendt end as date_opened

from table1 a left join table2 b

on a.name=b.name

where (a.height&amp;gt;50 and b.prodcd = ' ');

quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Syntax error:&lt;/P&gt;&lt;P&gt;Syntax error: expected something between '(' and ')'.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 18:47:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524649#M142686</guid>
      <dc:creator>astha8882000</dc:creator>
      <dc:date>2019-01-04T18:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: case when syntax error in</title>
      <link>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524660#M142692</link>
      <description>&lt;P&gt;Can you post the log&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 19:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524660#M142692</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-04T19:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: case when syntax error in</title>
      <link>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524669#M142698</link>
      <description>&lt;P&gt;I don't find any issue with the code, it works fine with my sample data. Make sure that the data types you defined are same in the source tables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prodcd - Is this a character variable, if its numeric then you might need to give proccd=. (period) for numeric missing value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data table1;
set sashelp.class(keep=name height);
run;

data table2;
set sashelp.class(keep=name weight);
opendt='01JAN2018'd;
prodcd = ' ';
run;

proc sql;
create table abc as
select a.name, a.height, b.opendt,
case when today()-b.opendt&amp;gt;200 then b.opendt end as date_opened
from table1 a 
	left join table2 b
on a.name=b.name
where (a.height&amp;gt;50 and b.prodcd = ' ');
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 19:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/case-when-syntax-error-in/m-p/524669#M142698</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2019-01-04T19:26:32Z</dc:date>
    </item>
  </channel>
</rss>

