<?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 file saving with sas date format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361362#M85202</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am saving an excel file with a date variable as part of the file name. my problem is that the file is saved using SAS date format rather than a calander date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is a sample code that I am using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;format week comma10.0;&lt;BR /&gt;format date MONYY.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;week = 1;&lt;/P&gt;
&lt;P&gt;date = intnx('month',today(),0);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;call symputx('week',week);&lt;BR /&gt;call symputx('date',date);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let label = &amp;amp;date. week &amp;amp;week.;&lt;BR /&gt;%put &amp;amp;label.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt; file cmds;&lt;BR /&gt; put "[save.as(%bquote("C:\Report &amp;amp;label..xlsx"))]";&lt;BR /&gt; &lt;BR /&gt; put '[CLOSE()]';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;file is saving like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report 20940 week 1.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want file to save as Report May2017 week 1.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by somehow converting sas date format to monthyear date format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&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>Wed, 24 May 2017 19:41:36 GMT</pubDate>
    <dc:creator>tparvaiz</dc:creator>
    <dc:date>2017-05-24T19:41:36Z</dc:date>
    <item>
      <title>file saving with sas date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361362#M85202</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am saving an excel file with a date variable as part of the file name. my problem is that the file is saved using SAS date format rather than a calander date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is a sample code that I am using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;format week comma10.0;&lt;BR /&gt;format date MONYY.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;week = 1;&lt;/P&gt;
&lt;P&gt;date = intnx('month',today(),0);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;call symputx('week',week);&lt;BR /&gt;call symputx('date',date);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let label = &amp;amp;date. week &amp;amp;week.;&lt;BR /&gt;%put &amp;amp;label.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt; file cmds;&lt;BR /&gt; put "[save.as(%bquote("C:\Report &amp;amp;label..xlsx"))]";&lt;BR /&gt; &lt;BR /&gt; put '[CLOSE()]';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;file is saving like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report 20940 week 1.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want file to save as Report May2017 week 1.xlsx&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;by somehow converting sas date format to monthyear date format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&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>Wed, 24 May 2017 19:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361362#M85202</guid>
      <dc:creator>tparvaiz</dc:creator>
      <dc:date>2017-05-24T19:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: file saving with sas date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361371#M85206</link>
      <description>&lt;P&gt;You can do this by changing the value assigned to &amp;amp;LABEL.&amp;nbsp; I'm going to show you something&amp;nbsp;a little different than what you asked for:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let label = %sysfunc(putn(&amp;amp;date., yymmn6.)) week &amp;amp;week.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will give you 201705 instead of May2017.&amp;nbsp; That way, all your file names will alphabetize in chronological order.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 19:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361371#M85206</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-24T19:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: file saving with sas date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361395#M85217</link>
      <description>&lt;P&gt;Thanks for your assistance&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 20:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/file-saving-with-sas-date-format/m-p/361395#M85217</guid>
      <dc:creator>tparvaiz</dc:creator>
      <dc:date>2017-05-24T20:55:48Z</dc:date>
    </item>
  </channel>
</rss>

