<?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 SAS Date and Macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314355#M313080</link>
    <description>&lt;P&gt;This is killing me, if someone can help I'd be exceedingly grateful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this program snippet. &amp;nbsp;In the last proc sql I am getting an error with the date. &amp;nbsp;Why won't it take my date variable????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help? &amp;nbsp;Error message followed by code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;NOTE: Line generated by the macro variable "DAYDATE1".&lt;BR /&gt;18 24NOV2016&lt;BR /&gt;_______&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&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;BR /&gt;GT, GTT, LE, LET, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dates;&lt;BR /&gt;daydate1=intnx('day',today(),-1,'B');&lt;BR /&gt;FORMAT daydate1 date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select daydate1 into :daydate1 FROM dates;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to sqlsvr as sqlsvr (dsn=sqlserverp authdomain=sqlauthp);&lt;BR /&gt;create table work.submit as&lt;BR /&gt;select * from connection to sqlsvr&lt;BR /&gt;(select ID, store_number, min(rpt_dt) as Submit_Dt&lt;BR /&gt;from&amp;nbsp;Appstable&lt;/P&gt;&lt;P&gt;group by ID, store_number&lt;BR /&gt;order by ID&amp;nbsp;asc);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table subday as select input(store_number,4.) as store, count(ID) as Submits&lt;BR /&gt;from submit where submit_dt = &amp;amp;daydate1&lt;BR /&gt;group by store_number;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Nov 2016 18:59:27 GMT</pubDate>
    <dc:creator>TedCarol</dc:creator>
    <dc:date>2016-11-25T18:59:27Z</dc:date>
    <item>
      <title>SAS Date and Macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314355#M313080</link>
      <description>&lt;P&gt;This is killing me, if someone can help I'd be exceedingly grateful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this program snippet. &amp;nbsp;In the last proc sql I am getting an error with the date. &amp;nbsp;Why won't it take my date variable????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help? &amp;nbsp;Error message followed by code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;NOTE: Line generated by the macro variable "DAYDATE1".&lt;BR /&gt;18 24NOV2016&lt;BR /&gt;_______&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&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;BR /&gt;GT, GTT, LE, LET, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.&lt;/P&gt;&lt;P&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dates;&lt;BR /&gt;daydate1=intnx('day',today(),-1,'B');&lt;BR /&gt;FORMAT daydate1 date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select daydate1 into :daydate1 FROM dates;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to sqlsvr as sqlsvr (dsn=sqlserverp authdomain=sqlauthp);&lt;BR /&gt;create table work.submit as&lt;BR /&gt;select * from connection to sqlsvr&lt;BR /&gt;(select ID, store_number, min(rpt_dt) as Submit_Dt&lt;BR /&gt;from&amp;nbsp;Appstable&lt;/P&gt;&lt;P&gt;group by ID, store_number&lt;BR /&gt;order by ID&amp;nbsp;asc);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table subday as select input(store_number,4.) as store, count(ID) as Submits&lt;BR /&gt;from submit where submit_dt = &amp;amp;daydate1&lt;BR /&gt;group by store_number;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2016 18:59:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314355#M313080</guid>
      <dc:creator>TedCarol</dc:creator>
      <dc:date>2016-11-25T18:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date and Macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314519#M313081</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Assuming that the variable you are selecting on is a date variable (numeric) and not a character string, you are using &amp;amp;daydate incorrectly. With my #1 example, I can duplicate your error message. With my #2 example, I correctly use "&amp;amp;daydate"d to select the row with that date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6037iF7CEDB09E4C0C32C/image-size/original?v=v2&amp;amp;px=-1" alt="use_date_constant.png" title="use_date_constant.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 01:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314519#M313081</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-11-27T01:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date and Macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314525#M313082</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/116860"&gt;@TedCarol﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Please don't post the same question twice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cross reference to your other post&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/error-with-date9-field-set-equal-to-macro-variable-in-where/m-p/314360#U314360" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/error-with-date9-field-set-equal-to-macro-variable-in-where/m-p/314360#U314360&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2016 02:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Date-and-Macro-variable/m-p/314525#M313082</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-11-27T02:26:42Z</dc:date>
    </item>
  </channel>
</rss>

