<?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 Proc DS2 with Macro date variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/471123#M120643</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sales_date = "01JAN2018"d;

proc ds2;

	data sales_data/overwrite = 'YES';
		retain count;

		method run();
			set {select * from sales.sales_data where sales_date &amp;gt;=&amp;amp;sales_date. };

		end;

	enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi , I want to understand how to use macro date variable in PROC DS2. sales_date is macro variable and want to use fetch data from sas dataset sales.sales_data after this date. There has been lot of other codes also so jsut added only relevant code to show what is needed. Overall, how to use macro variable in proc ds2 which is sas date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jun 2018 15:15:35 GMT</pubDate>
    <dc:creator>nkm</dc:creator>
    <dc:date>2018-06-18T15:15:35Z</dc:date>
    <item>
      <title>Proc DS2 with Macro date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/471123#M120643</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sales_date = "01JAN2018"d;

proc ds2;

	data sales_data/overwrite = 'YES';
		retain count;

		method run();
			set {select * from sales.sales_data where sales_date &amp;gt;=&amp;amp;sales_date. };

		end;

	enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi , I want to understand how to use macro date variable in PROC DS2. sales_date is macro variable and want to use fetch data from sas dataset sales.sales_data after this date. There has been lot of other codes also so jsut added only relevant code to show what is needed. Overall, how to use macro variable in proc ds2 which is sas date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 15:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/471123#M120643</guid>
      <dc:creator>nkm</dc:creator>
      <dc:date>2018-06-18T15:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc DS2 with Macro date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/471574#M120802</link>
      <description>&lt;P&gt;Macro variables work fine.&lt;/P&gt;
&lt;P&gt;Your syntax is incorrect.&lt;/P&gt;
&lt;P&gt;This works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sales_date = date'2018-01-01';

data TEST; 
  D='01jan2018'd;
run;

proc ds2;
  data T/overwrite = 'YES';
    method run();
      set { select * from TEST where D = &amp;amp;sales_date. };
    end;
  enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;NOTE: Execution succeeded. One row affected.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 01:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/471574#M120802</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-20T01:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc DS2 with Macro date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/472203#M121038</link>
      <description>Thanks ChrisNZ for your help. Sorry if I was not clear but what I was looking for how to use "01JAN2018"d. Is there any way to use the same by converting it to ds2 date type or it is not possible to use D type of string in proc ds2. to_double("01JAN2018"d) --- is there any way to use ?</description>
      <pubDate>Thu, 21 Jun 2018 16:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/472203#M121038</guid>
      <dc:creator>nkm</dc:creator>
      <dc:date>2018-06-21T16:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Proc DS2 with Macro date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/472334#M121101</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sales_date = '01jan2018'd;

data TEST; 
  D='01jan2018'd;
run;

proc ds2;
  data T/overwrite = 'YES';
    method run();
      set { select * from TEST where D = date%nrbquote('%sysfunc(putn(&amp;amp;sales_date.,yymmddd10.))') };
    end;
  enddata;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NOTE: Execution succeeded. One row affected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 23:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/472334#M121101</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-21T23:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc DS2 with Macro date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/472372#M121126</link>
      <description>&lt;P&gt;PROC DS2 does not understand SAS date literals?&lt;/P&gt;
&lt;P&gt;Who made that design decision?&lt;/P&gt;
&lt;P&gt;What other types of SAS literals does PROC DS2 not understand?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 04:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-DS2-with-Macro-date-variable/m-p/472372#M121126</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-06-22T04:57:24Z</dc:date>
    </item>
  </channel>
</rss>

