<?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 How to format a global variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40551#M4863</link>
    <description>I define a global variable as follows:&lt;BR /&gt;
          %let todaydate=today();&lt;BR /&gt;
and SAS assign a number to the 'todaydate'. Anyone knows whether it is possible for me to format the 'todaydate', e.g. ddmmyy or ddmonyy etc?</description>
    <pubDate>Wed, 20 Aug 2008 12:25:14 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-08-20T12:25:14Z</dc:date>
    <item>
      <title>How to format a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40551#M4863</link>
      <description>I define a global variable as follows:&lt;BR /&gt;
          %let todaydate=today();&lt;BR /&gt;
and SAS assign a number to the 'todaydate'. Anyone knows whether it is possible for me to format the 'todaydate', e.g. ddmmyy or ddmonyy etc?</description>
      <pubDate>Wed, 20 Aug 2008 12:25:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40551#M4863</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-08-20T12:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40552#M4864</link>
      <description>Try&lt;BR /&gt;
&lt;BR /&gt;
%let todaydate = %sysfunc(putn("&amp;amp;SYSDATE9"D,ddmmyy.));&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Linus</description>
      <pubDate>Wed, 20 Aug 2008 12:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40552#M4864</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-08-20T12:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40553#M4865</link>
      <description>Hi:&lt;BR /&gt;
  If you DO want to use the today() function instead of &amp;amp;SYSDATE9, you can use it directly in the %LET, and with the TODAY() function, a second argument is allowed for %SYSFUNC that formats the returned date:&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let d1 = %sysfunc(today(),ddmmyy.);&lt;BR /&gt;
%let d2 = %sysfunc(today(),worddate.);&lt;BR /&gt;
%let d3 = %sysfunc(today(),mmddyy10.);&lt;BR /&gt;
%let d4 = %sysfunc(putn("&amp;amp;sysdate9"d ,mmddyyp10.));&lt;BR /&gt;
%let d5 = %sysfunc(putn('01Jan2008'd ,weekdate.));&lt;BR /&gt;
           &lt;BR /&gt;
%put d1= &amp;amp;d1;&lt;BR /&gt;
%put d2= &amp;amp;d2;&lt;BR /&gt;
%put d3= &amp;amp;d3;&lt;BR /&gt;
%put d4= &amp;amp;d4;&lt;BR /&gt;
%put d5= &amp;amp;d5;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 20 Aug 2008 12:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40553#M4865</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-08-20T12:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40554#M4866</link>
      <description>Hihi,&lt;BR /&gt;
&lt;BR /&gt;
just tried but sas still assign some other number to the date..</description>
      <pubDate>Wed, 20 Aug 2008 12:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40554#M4866</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-08-20T12:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40555#M4867</link>
      <description>Hi:&lt;BR /&gt;
  &amp;amp;SYSDATE may not be the same date as TODAY(). Especially if your version of SAS is on a server that is not taken down often. Usually &amp;amp;SYSDATE is the date that the SAS session started...while TODAY() returns a value from the computer's "calendar/clock" functions.&lt;BR /&gt;
 &lt;BR /&gt;
  Are you saying that today() does not return today's date????&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let x = %sysfunc(today());&lt;BR /&gt;
%let y = %sysfunc(today(),mmddyy10.);&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
If these statements do not produce the following results, then you should contact Tech Support for more help. (If you're on the other side of the international date line, of course, your date will be off from mine by a day.&lt;BR /&gt;
[pre]&lt;BR /&gt;
1    %let x = %sysfunc(today());&lt;BR /&gt;
2    %let y = %sysfunc(today(),mmddyy10.);&lt;BR /&gt;
3&lt;BR /&gt;
4    %put *******x=&amp;amp;x y=&amp;amp;y;&lt;BR /&gt;
*******x=17764 y=08/20/2008&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
Today's date in as a SAS number is 17764. With the mmddyy10. format applied, the macro variable &amp;amp;Y has a value of 08/20/2008.&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 20 Aug 2008 16:42:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40555#M4867</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2008-08-20T16:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to format a global variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40556#M4868</link>
      <description>Hi..&lt;BR /&gt;
&lt;BR /&gt;
I manage to get it already! Thanks so much for everybody's help.&lt;BR /&gt;
\(^o^)/</description>
      <pubDate>Thu, 21 Aug 2008 11:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-format-a-global-variable/m-p/40556#M4868</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-08-21T11:02:31Z</dc:date>
    </item>
  </channel>
</rss>

