<?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: Global macro to format dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101623#M28530</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that the comparisons in the where clause are case sensitive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select var_date into :var_dates separated by&amp;nbsp; " "&lt;/P&gt;&lt;P&gt;from sashelp.vtable&lt;/P&gt;&lt;P&gt;where libname="SASHELP" and memname="STOCKS" and format="DATE9." ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;format &amp;amp;var_dates mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Oct 2013 17:35:50 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-10-02T17:35:50Z</dc:date>
    <item>
      <title>Global macro to format dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101621#M28528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I imported a spreadsheet into sas.&amp;nbsp; I ran some queries against the import and it is ready for distribution.&amp;nbsp; The dates are in date9 format.&amp;nbsp; Is there a global macro that I can plug in to do an auto change to mmddyy10.&lt;/P&gt;&lt;P&gt;I could export it, then import again and define the dates, however there are about 30 columns with dates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 17:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101621#M28528</guid>
      <dc:creator>omega1983</dc:creator>
      <dc:date>2013-10-02T17:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Global macro to format dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101622#M28529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To change the way that a variable is displayed you just need to use a FORMAT statement.&lt;/P&gt;&lt;P&gt;In your case it would be in the form:&lt;/P&gt;&lt;P&gt;FORMAT var1 var2 ..... MMDDYY10. ;&lt;/P&gt;&lt;P&gt;If you add it to a data step then the formats are permanently attached, or you could just use it in the report step where you want to use a different display format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can automate the generation of the list of variable names by querying the metadata.&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt; select name into :datevars separated by ' '&lt;/P&gt;&lt;P&gt; from dictionary.columns &lt;/P&gt;&lt;P&gt;&amp;nbsp; where libname='MYLIB' and memname='MYDATA'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and format = 'DATE'&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;format &amp;amp;datevars MMDDYY10. ;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 17:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101622#M28529</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-10-02T17:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Global macro to format dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101623#M28530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that the comparisons in the where clause are case sensitive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select var_date into :var_dates separated by&amp;nbsp; " "&lt;/P&gt;&lt;P&gt;from sashelp.vtable&lt;/P&gt;&lt;P&gt;where libname="SASHELP" and memname="STOCKS" and format="DATE9." ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;format &amp;amp;var_dates mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 17:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Global-macro-to-format-dates/m-p/101623#M28530</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-10-02T17:35:50Z</dc:date>
    </item>
  </channel>
</rss>

