<?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: SAS EG not recognizing 0 value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/779938#M31599</link>
    <description>&lt;P&gt;What do you mean, "&lt;SPAN&gt;is doesnt recognize the "0" ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you show us some data?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Nov 2021 09:04:39 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-11-12T09:04:39Z</dc:date>
    <item>
      <title>SAS EG not recognizing 0 value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/779936#M31598</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would like to check why SAS EG is not recognizing "0" in my formula?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the sample computation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;product: SUM(client1,client2)&lt;/P&gt;&lt;P&gt;product_count: SUM(PURCHASE1,PURCHASE2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the result of this calculation, I would have to create another tagging:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;CASE WHEN t1.product &amp;gt;=3 AND t1.product_count=0THEN 'A'&lt;/P&gt;&lt;P&gt;WHEN&amp;nbsp; t1.product =2 AND t1.product_count=1 THEN 'B'&lt;/P&gt;&lt;P&gt;WHEN&amp;nbsp; t1.product =0 AND t1.product_count=1 THEN 'C'&lt;/P&gt;&lt;P&gt;ELSE&amp;nbsp; 'D'&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Now my Problem is doesnt recognize the "0" value in product calculation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 08:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/779936#M31598</guid>
      <dc:creator>agdee26</dc:creator>
      <dc:date>2021-11-12T08:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG not recognizing 0 value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/779938#M31599</link>
      <description>&lt;P&gt;What do you mean, "&lt;SPAN&gt;is doesnt recognize the "0" ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you show us some data?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 09:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/779938#M31599</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-12T09:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG not recognizing 0 value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/780018#M31605</link>
      <description>&lt;P&gt;Are you sure that you have values of 0 for Product_count when Product is &amp;gt;= 3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can run this code to see if your combination(s) actually have any records.&lt;/P&gt;
&lt;P&gt;Proc freq data=yourdataset;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; tables product * product_count / list missing;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Nov 2021 17:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/780018#M31605</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-12T17:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG not recognizing 0 value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/780032#M31608</link>
      <description>You're missing a space between the 0 and THEN, does the log indicate any issues with that?</description>
      <pubDate>Fri, 12 Nov 2021 19:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/780032#M31608</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-12T19:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS EG not recognizing 0 value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/780319#M31623</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;You're missing a space between the 0 and THEN, does the log indicate any issues with that?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I tested that and surprisingly enough SAS doesn't complain:&lt;/P&gt;
&lt;PRE&gt;39   Proc sql;
40       create table junk as
41       select *,
42          case when age=13then 'A'
43          else 'B' end as group
44      from sashelp.class
45      ;
NOTE: Table WORK.JUNK created, with 19 rows and 6 columns.

46   quit;
&lt;/PRE&gt;
&lt;P&gt;Result is A for age 13 and B otherwise in the output data. So the code parser is a bit better than expected. Possibly because of the "variables can't start with digits" rules.&amp;nbsp; However because the "then" starts with T the same isn't true with Character variables:&lt;/P&gt;
&lt;PRE&gt;47   Proc sql;
48       create table junk as
49       select *,
50          case when name='Alfred'then 'A'
ERROR: Invalid date/time/datetime constant 'Alfred't.
50          case when name='Alfred'then 'A'
                                    ---
                                    22
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, GE, GET, GT, GTT, LE, LET, LT, LTT, NE, NET, NOT, OR, THEN,
              ^, ^=, |, ||, ~, ~=.

50          case when name='Alfred'then 'A'
                                    ---
                                    202
ERROR 202-322: The option or parameter is not recognized and will be ignored.

51          else 'B' end as group
52      from sashelp.class
53      ;
54   quit
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 23:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-EG-not-recognizing-0-value/m-p/780319#M31623</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-11-15T23:29:31Z</dc:date>
    </item>
  </channel>
</rss>

