<?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 Date variable macro in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482207#M31246</link>
    <description>&lt;P&gt;Thank&amp;nbsp;you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;for the answer. While I appreciate your answer, will those variables in Data be converted into Macro Variable?&lt;BR /&gt;&lt;BR /&gt;If not, I give these variables in one program in Enterprise guide and use it in different &lt;SPAN&gt;programmes&lt;/SPAN&gt;&amp;nbsp;as well. Can these values be transferred to different programmes as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Sat, 28 Jul 2018 21:35:58 GMT</pubDate>
    <dc:creator>hvempati</dc:creator>
    <dc:date>2018-07-28T21:35:58Z</dc:date>
    <item>
      <title>SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482201#M31243</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating&amp;nbsp;a macro variable for dates such that&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let change_date= '&lt;SPAN&gt;2018-07-01&lt;/SPAN&gt;'&lt;/P&gt;&lt;P&gt;%put &amp;amp;change_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let interval = 15 (or 30 or 45)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and it should give me a macro variable with dates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let previous_end_date = '2018-06-30' (This is change_date -1)&lt;/P&gt;&lt;P&gt;%let previous_start_date= '2018-06-16' (this is change_date -15)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let current_start_date= '2018-07-02' (This is change_date+1)&lt;/P&gt;&lt;P&gt;%let current_end_date= '2018-07-16' (This is change_date+15)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the dates to be in this format as this is how Teradata accept the date values. Can you help me out on how to do this macro's calculation?&lt;BR /&gt;&lt;BR /&gt;Any help is highly appreciated.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 21:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482201#M31243</guid>
      <dc:creator>hvempati</dc:creator>
      <dc:date>2018-07-28T21:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482202#M31244</link>
      <description>&lt;P&gt;Do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   change_date= '01jul2018'd;

   previous_end_date=change_date-1;
   previous_start_date=change_date-15;

   current_start_date=change_date+1;
   current_end_date=change_date+15;

   put (_ALL_)(=);
   format _numeric_ date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Jul 2018 21:13:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482202#M31244</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-28T21:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482203#M31245</link>
      <description>&lt;P&gt;If it is absolutely necessary to put them into macro variables, use call symput logic.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 21:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482203#M31245</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-28T21:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482207#M31246</link>
      <description>&lt;P&gt;Thank&amp;nbsp;you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;for the answer. While I appreciate your answer, will those variables in Data be converted into Macro Variable?&lt;BR /&gt;&lt;BR /&gt;If not, I give these variables in one program in Enterprise guide and use it in different &lt;SPAN&gt;programmes&lt;/SPAN&gt;&amp;nbsp;as well. Can these values be transferred to different programmes as well?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 21:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482207#M31246</guid>
      <dc:creator>hvempati</dc:creator>
      <dc:date>2018-07-28T21:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482209#M31247</link>
      <description>&lt;P&gt;Use CALL SYMPUT logic to read the date values into macro variables like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   change_date= '01jul2018'd;

   previous_end_date=change_date-1;
   previous_start_date=change_date-15;

   current_start_date=change_date+1;
   current_end_date=change_date+15;

   call symputx('previous_end_date',previous_end_date);
   call symputx('previous_start_date',previous_start_date);
   call symputx('current_start_date',current_start_date);
   call symputx('current_end_date',current_end_date);

   put (_ALL_)(=);
   format _numeric_ date9.;
run;

%put _USER_;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Jul 2018 21:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482209#M31247</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-28T21:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482210#M31248</link>
      <description>Can you edit the format as '2018-07-02' (yy-mm--dd) in the answer. Thank you so much..!!</description>
      <pubDate>Sat, 28 Jul 2018 21:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482210#M31248</guid>
      <dc:creator>hvempati</dc:creator>
      <dc:date>2018-07-28T21:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482240#M31249</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220513"&gt;@hvempati&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Can you edit the format as '2018-07-02' (yy-mm--dd) in the answer. Thank you so much..!!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can use the PUT() and QUOTE() functions with CALL SYMPUTX() .&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx('my_macro_var',quote(put(mysasdate,yymmdd10.),"'"));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Jul 2018 05:50:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/482240#M31249</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-07-29T05:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/483116#M31316</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you think there would be a performance issue by using a method like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was using a method where I was manually inputting&amp;nbsp;all the dates. But now by using this method, I have seen the runtime for the same code was slow. (previously the code ran for 3 minutes, but now it runs for 10 minutes.) I haven't changed anything except this.&lt;BR /&gt;&lt;BR /&gt;Any inputs on this?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 17:16:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/483116#M31316</guid>
      <dc:creator>hvempati</dc:creator>
      <dc:date>2018-08-01T17:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date variable macro</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/483127#M31317</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220513"&gt;@hvempati&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you think there would be a performance issue by using a method like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was using a method where I was manually inputting&amp;nbsp;all the dates. But now by using this method, I have seen the runtime for the same code was slow. (previously the code ran for 3 minutes, but now it runs for 10 minutes.) I haven't changed anything except this.&lt;BR /&gt;&lt;BR /&gt;Any inputs on this?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There is no difference between running code like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select * from have where date = '2017-12-01'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the same code generated by using a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mvar='2017-12-01';
...
select * from have where date = &amp;amp;mvar&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are seeing a difference then either your data has changed or your query has changed.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 17:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-variable-macro/m-p/483127#M31317</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-01T17:32:46Z</dc:date>
    </item>
  </channel>
</rss>

