<?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: how do i create a macro variable of todays date like this  20170424 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353054#M82380</link>
    <description>&lt;P&gt;You can also look into &amp;amp;SYSDATE which is an automatic macro variable. Depending on how you're submitting a job, this may or may not be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n08zfkx3lmiagpn11fctkfvfx1sg.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n08zfkx3lmiagpn11fctkfvfx1sg.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2017 01:43:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-04-25T01:43:51Z</dc:date>
    <item>
      <title>how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/352976#M82349</link>
      <description>&lt;P&gt;I need todays date in a macro variable like that.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I tried&amp;nbsp;yymmdd8. but it came out like&amp;nbsp;mmddyy8. &amp;nbsp;(per chart below...)&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/8520iADF4641B4002E85C/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Untitled.png" title="Untitled.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 19:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/352976#M82349</guid>
      <dc:creator>cellurl</dc:creator>
      <dc:date>2017-04-24T19:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/352978#M82350</link>
      <description>&lt;P&gt;&lt;BR /&gt;%let todaysDate = %sysfunc(today(), yymmddn8.);&lt;BR /&gt;%put &amp;amp;todaysDate;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 19:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/352978#M82350</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-24T19:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353054#M82380</link>
      <description>&lt;P&gt;You can also look into &amp;amp;SYSDATE which is an automatic macro variable. Depending on how you're submitting a job, this may or may not be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n08zfkx3lmiagpn11fctkfvfx1sg.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n08zfkx3lmiagpn11fctkfvfx1sg.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 01:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353054#M82380</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T01:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353059#M82382</link>
      <description>&lt;P&gt;i was hoping for a solution of this variety (which doesn't work...)&lt;/P&gt;
&lt;P&gt;After 5 years of sas work, I am still clueless on dates.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;format dt mmddyy10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;dt= date();&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;call symput('dt',trim(left(input(dt,mmddyy10.)));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;dt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 01:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353059#M82382</guid>
      <dc:creator>cellurl</dc:creator>
      <dc:date>2017-04-25T01:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353068#M82383</link>
      <description>&lt;P&gt;Dates are numbers. To convert it to a character, use PUT with the format you'd like it to appear with.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your solution was overcomplicated. Here's the simplified version, note I'm using CALL SYMPUTX() to create a global macro variable with no trailing spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   call symputx('dt',put(date(),mmddyy10.), 'g');
run;
 
%put &amp;amp;dt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Apr 2017 02:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353068#M82383</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-25T02:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353071#M82384</link>
      <description>&lt;P&gt;What format you have attached to the variable doesn't matter, in fact you do not even need to create a variable. You want to use PUT() function to convert a value to a character string not the INPUT() function. The INPUT() function is for converting character strings into stored values. &amp;nbsp;It is easy to remember if you think of the PUT and INPUT statements that are used to write and read characters from text files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the DATE() function (or its alias today()) to get the date when the statement runs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   call symputx('dt',put(date(),yymmddn8.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or you can use the automatic macro variable SYSDATE9 to get the date when the program started (which might be yesterday or even earlier if you have a long runnning job).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   call symputx('dt',put("&amp;amp;sysdate9"d,yymmddn8.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 02:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353071#M82384</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-25T02:15:55Z</dc:date>
    </item>
    <item>
      <title>Re: how do i create a macro variable of todays date like this  20170424</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353391#M82493</link>
      <description>&lt;P&gt;thanks, i used your first one.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2017 18:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-i-create-a-macro-variable-of-todays-date-like-this/m-p/353391#M82493</guid>
      <dc:creator>cellurl</dc:creator>
      <dc:date>2017-04-25T18:54:10Z</dc:date>
    </item>
  </channel>
</rss>

