<?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: Appending Macro Variable Name to End of Export File in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567930#M11597</link>
    <description>&lt;P&gt;You kind of need to show the existing code you are using/ trying. The are &lt;STRONG&gt;many&lt;/STRONG&gt; ways this might be accomplished and knowing what you start with will make responses much more useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post code into a code box opened using the forum's {I} or "running man" icons to preserve layout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If instead of 21074 you want something related to 12SEP2017 then somewhere you need to use the proper display format for the value, which you have &lt;STRONG&gt;not&lt;/STRONG&gt; provided.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 14:32:22 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-06-21T14:32:22Z</dc:date>
    <item>
      <title>Appending Macro Variable Name to End of Export File</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567906#M11588</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to append a macro to the end of an excel file that I am exporting, so the new file name will be&amp;nbsp;&lt;EM&gt;filename_macro.xlsx.&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The macro variable is a date and right now it is outputting as the SAS date(just a number) with a space in front of the number. For example it looks like&amp;nbsp;&lt;EM&gt;filename_ 21074.xlsx.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My final goal is to be able to compare the file from this week to the file from last week. I don't know if this space needs to be deleted but I was planning on doing a compare on the current file and the file named&amp;nbsp;&lt;EM&gt;filename_(macro-7).&lt;/EM&gt; If there is an easier way to do this please let me know!&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 13:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567906#M11588</guid>
      <dc:creator>alexgouv</dc:creator>
      <dc:date>2019-06-21T13:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Macro Variable Name to End of Export File</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567930#M11597</link>
      <description>&lt;P&gt;You kind of need to show the existing code you are using/ trying. The are &lt;STRONG&gt;many&lt;/STRONG&gt; ways this might be accomplished and knowing what you start with will make responses much more useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post code into a code box opened using the forum's {I} or "running man" icons to preserve layout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If instead of 21074 you want something related to 12SEP2017 then somewhere you need to use the proper display format for the value, which you have &lt;STRONG&gt;not&lt;/STRONG&gt; provided.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567930#M11597</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-21T14:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Appending Macro Variable Name to End of Export File</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567931#M11598</link>
      <description>&lt;P&gt;Sounds like you want use the value of macro variable to construct a filename?&lt;/P&gt;
&lt;P&gt;So if your macro variable has the value&amp;nbsp;21074 and you want to interpret that as a date and generate a human readable string that you could include as part of the filename you need to use a FORMAT.&amp;nbsp; I would recommend either YYMMDDD10. (2017-09-12) or YYMMDDN8. (20170912) so that your resulting filenames will sort in chronological order.&lt;/P&gt;
&lt;P&gt;Perhaps you can apply the format earlier so that the macro variable already looks like the string you want. Or else use the %SYSFUNC() to call the PUTN() function to apply the format to the value.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date=21074;
%let filename=filename_%sysfunc(putn(&amp;amp;date,yymmddn8.)).xlsx;
proc export file="&amp;amp;filename" ....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Appending-Macro-Variable-Name-to-End-of-Export-File/m-p/567931#M11598</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-21T14:35:09Z</dc:date>
    </item>
  </channel>
</rss>

