<?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: SAS: dataset name Remove the date and replace with the current date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502714#M134237</link>
    <description>&lt;P&gt;is the - a typo&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;%Let&lt;/SPAN&gt;&lt;SPAN&gt; Filename_Stg &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Filename_temp &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Date_String&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;should it be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;%Let&lt;/SPAN&gt;&lt;SPAN&gt; Filename_Stg &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Filename_temp_&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Date_String&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Oct 2018 14:30:47 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2018-10-09T14:30:47Z</dc:date>
    <item>
      <title>SAS: dataset name Remove the date and replace with the current date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502709#M134232</link>
      <description>&lt;P&gt;I currently have a macro which moves my dataset from one branch to another. In each movement, the date is updated. However, I am having trouble with removing the old date autonomously before inputting the new date, any advice?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Macro Merge_Branch(Branch = , Filename = , Library = );

	%Let Timestamp = %sysfunc(putn(%sysfunc(date()),yymmddn8.));

	%if &amp;amp;Branch. = Latest_Commit %then %do;
		
		Data LC._&amp;amp;Timestamp._&amp;amp;Filename.;
		set &amp;amp;Library..&amp;amp;Filename.;
		run;

	%end;

	%else %if &amp;amp;Branch. = Staging %then %do;

		%Let Filename = _20180909_Financial_Input;
		%Let Filename_temp = %scan(&amp;amp;Filename.,2,'_');
                %Let Date_String = %scan(&amp;amp;Filename.,1,'_');
                /* this is the section where I get stuck the dash is a subtraction i.e. I want to remove the date and just have the string*/
		%Let Filename_Stg = &amp;amp;Filename_temp - &amp;amp;Date_String;

		Data Stg._&amp;amp;Timestamp._&amp;amp;Filename_Stg.;
		set LC.&amp;amp;Filename.;
		run;

	%end;

%mend;

Input data can be made like this

data LC._20180909_Financial_Input;
var var1;
datalines;
1
1
1
1
;
run;

%Macro Merge_Branch(Branch = Staging , Filename = Financial_Input, Library = LC );

/*Note, in this macro the library is not important because it will always move from LC to STG*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Oct 2018 14:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502709#M134232</guid>
      <dc:creator>78282219</dc:creator>
      <dc:date>2018-10-09T14:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: dataset name Remove the date and replace with the current date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502714#M134237</link>
      <description>&lt;P&gt;is the - a typo&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;%Let&lt;/SPAN&gt;&lt;SPAN&gt; Filename_Stg &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Filename_temp &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Date_String&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;should it be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;%Let&lt;/SPAN&gt;&lt;SPAN&gt; Filename_Stg &lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Filename_temp_&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;Date_String&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 14:30:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502714#M134237</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-09T14:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS: dataset name Remove the date and replace with the current date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502716#M134238</link>
      <description>&lt;P&gt;It's more like a subtraction so i'm trying to make the following happen&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_20181009_Financial_Input - _20181009_ = Financial_Input&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then in the next step I will create a dataset name where there will be the most recent date (in this case it is the most recent date but in future there will be discrepancies)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 14:35:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-name-Remove-the-date-and-replace-with-the-current/m-p/502716#M134238</guid>
      <dc:creator>78282219</dc:creator>
      <dc:date>2018-10-09T14:35:21Z</dc:date>
    </item>
  </channel>
</rss>

