<?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 Question on computed columns in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35321#M4444</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't answer your question about the prompt, but still advise that you change the order of your when statements.&amp;nbsp; Since the first must be correct before the second is addressed, the second one will never be recognized.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jan 2012 15:52:59 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2012-01-24T15:52:59Z</dc:date>
    <item>
      <title>Question on computed columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35318#M4441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone show me what I am doing wrong with this computed column case function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿CASE t1.event_date&lt;/P&gt;&lt;P&gt;WHEN (DATDIF(t1.event_date, DATE(), 'act/act')) GT 383 THEN 60&lt;/P&gt;&lt;P&gt;﻿WHEN (DATDIF(t1.event_date, DATE(), 'act/act')) GT 383 AND (DATDIF(t1.event_date, DATE(), 'act/act')) LE 748 THEN 40&lt;/P&gt;&lt;P&gt;ELSE 0&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It runs, but only returns 0.&amp;nbsp; When I do the DATDIF function in it's own computed column, I get the correct numerical return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;﻿ &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2012 14:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35318#M4441</guid>
      <dc:creator>DaveD</dc:creator>
      <dc:date>2012-01-22T14:12:29Z</dc:date>
    </item>
    <item>
      <title>Question on computed columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35319#M4442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would think that your first when statement would override your second statement (i.e., to meet the second statement the first statement has to be true, thus the second statement never gets to be considered.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, don't know if it would make a difference, but you have one redundant set of parentheses in each when statement.&amp;nbsp; the following would suffice:&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;WHEN DATDIF(t1.event_date, DATE(), 'act/act') GT 383 THEN 60&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, you don't have to indicate t1.event_date in the case statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would test the calculations by changing the select statement to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select t1.event_date, &lt;SPAN style="background-color: #eef4f9;"&gt; DATDIF(t1.event_date, DATE(), 'act/act') as datedif,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;﻿CASE&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;WHEN DATDIF(t1.event_date, DATE(), 'act/act') GT 383 AND DATDIF(t1.event_date, DATE(), 'act/act') LE 748 THEN 40&lt;/P&gt;&lt;P&gt;WHEN DATDIF(t1.event_date, DATE(), 'act/act') GT 383 THEN 60&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;ELSE 0&lt;/P&gt;&lt;P style="background-color: #eef4f9;"&gt;END&lt;/P&gt;&lt;P&gt;as whatever&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and see what your calculations/comparisons are really doing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #eef4f9;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2012 14:37:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35319#M4442</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-22T14:37:44Z</dc:date>
    </item>
    <item>
      <title>Question on computed columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35320#M4443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Actually, less is better:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;David Dillard wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone show me what I am doing wrong with this computed column case function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;﻿CASE t1.event_date&lt;/P&gt;&lt;P&gt;WHEN (DATDIF(t1.event_date, DATE(), 'act/act')) GT 383 THEN 60&lt;/P&gt;&lt;P&gt;﻿WHEN (DATDIF(t1.event_date, DATE(), 'act/act')) GT 383 AND (DATDIF(t1.event_date, DATE(), 'act/act')) LE 748 THEN 40&lt;/P&gt;&lt;P&gt;ELSE 0&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It runs, but only returns 0.&amp;nbsp; When I do the DATDIF function in it's own computed column, I get the correct numerical return.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;﻿ &lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;What works is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE&lt;/P&gt;&lt;P&gt;WHEN DATDIF(t1.event_date, DATE(), 'act/act') GT 383 THEN 60&lt;/P&gt;&lt;P&gt;WHEN DATDIF(t1.event_date, DATE(), 'act/act') GT 383 AND DATDIF(t1.event_date, DATE(), 'act/act') LE 784 THEN 40&lt;/P&gt;&lt;P&gt;ELSE 0&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I am now trying to add a prompt to the WHEN statement and can not get it to recognize the prompt.&amp;nbsp; I have associated the prompt with the query, but when I add it to the WHEN line (WHEN DATDIF(t1.event_date, DATE(), 'act/act') GT 383 + &lt;STRONG&gt;&amp;amp;Prompt_offset &lt;/STRONG&gt;GT 383 THEN 60), it flags the &amp;amp;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help is greatly appreciated. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 15:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35320#M4443</guid>
      <dc:creator>DaveD</dc:creator>
      <dc:date>2012-01-24T15:06:24Z</dc:date>
    </item>
    <item>
      <title>Question on computed columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35321#M4444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't answer your question about the prompt, but still advise that you change the order of your when statements.&amp;nbsp; Since the first must be correct before the second is addressed, the second one will never be recognized.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 15:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35321#M4444</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-24T15:52:59Z</dc:date>
    </item>
    <item>
      <title>Question on computed columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35322#M4445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; You are absolutely correct.&amp;nbsp; The ordre of the statement is critical.&amp;nbsp; Thank you for pointing that out.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jan 2012 16:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Question-on-computed-columns/m-p/35322#M4445</guid>
      <dc:creator>DaveD</dc:creator>
      <dc:date>2012-01-24T16:08:42Z</dc:date>
    </item>
  </channel>
</rss>

