<?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: Prompts erroring in query in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395619#M25473</link>
    <description>&lt;P&gt;Oh my goodness. I thought I had tried that but I guess I did the single quotes which didn't work&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2017 16:34:37 GMT</pubDate>
    <dc:creator>mmagnuson</dc:creator>
    <dc:date>2017-09-13T16:34:37Z</dc:date>
    <item>
      <title>Prompts erroring in query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395600#M25471</link>
      <description>&lt;P&gt;I had a case statement,&lt;/P&gt;&lt;P&gt;(case when t1.Date &amp;gt; '01Jan2016' then "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when t.1L = "N" then "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when&amp;nbsp; t.1L = "M" then "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else "YES" end) As "NewColumn"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to make a prompt so that when the program was run a person could pick what date they wanted to run the report off of instead of it always being '01Jan2016' or having to go in and changing the value of the date.&lt;/P&gt;&lt;P&gt;I created a prompt 'eligible' and then put it in the code so that it now read this:&lt;/P&gt;&lt;P&gt;case when t1.Date &amp;gt; &amp;amp;eligible then "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when t.1L = "N" then "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when&amp;nbsp; t.1L = "M" then "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else "YES" end) As "NewColumn"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Now it gives me the erorr: "&lt;/P&gt;&lt;P&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, GE, GET,"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems as though the macro worked because it says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "ELIGIBLE".&lt;/P&gt;&lt;P&gt;40 01Jan2017&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 15:58:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395600#M25471</guid>
      <dc:creator>mmagnuson</dc:creator>
      <dc:date>2017-09-13T15:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Prompts erroring in query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395602#M25472</link>
      <description>&lt;P&gt;Your original program shouldn't work if your variable is actually a date, but if you want to make the new program look the same then you need to add quotes so that you are generating a valid string literal instead of just the text 01Jan2017.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case
  when t1.Date &amp;gt; "&amp;amp;eligible" then "NO"
  when t.1L = "N" then "NO"
  when  t.1L = "M" then "NO"
  else "YES" 
end As NewColumn&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If your DATE variable is really a date and not a character string then you need to write your query using a date literal instead of a string literal. &amp;nbsp;So add the letter D after the closing quote so SAS knows you mean a date and not just a string literal.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case
  when t1.Date &amp;gt; "&amp;amp;eligible"d then "NO"
  when t.1L = "N" then "NO"
  when  t.1L = "M" then "NO"
  else "YES" 
end As NewColumn&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 16:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395602#M25472</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-13T16:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Prompts erroring in query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395619#M25473</link>
      <description>&lt;P&gt;Oh my goodness. I thought I had tried that but I guess I did the single quotes which didn't work&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 16:34:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395619#M25473</guid>
      <dc:creator>mmagnuson</dc:creator>
      <dc:date>2017-09-13T16:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: Prompts erroring in query</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395620#M25474</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142148"&gt;@mmagnuson&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Oh my goodness. I thought I had tried that but I guess I did the single quotes which didn't work&lt;/P&gt;
&lt;P&gt;thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SAS does not evaluate macro triggers (&amp;amp; and %) inside of strings that use single quotes as the outer quotes.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2017 16:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prompts-erroring-in-query/m-p/395620#M25474</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-13T16:36:31Z</dc:date>
    </item>
  </channel>
</rss>

