<?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: Naming convention for previousmonth for my sas dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599159#M172901</link>
    <description>&lt;P&gt;Thank you so much. This worked for me.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Oct 2019 20:49:26 GMT</pubDate>
    <dc:creator>ilearnsas</dc:creator>
    <dc:date>2019-10-24T20:49:26Z</dc:date>
    <item>
      <title>Naming convention for previousmonth for my sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599106#M172872</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using proc append to add data from the previous month's dataset to a current months dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run 1—Last month—Dataset A -- ‘’Dataset_092019’’&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Run 2- This month- Dataset B –‘’dataset_102019’’&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Append- 2 &amp;nbsp;to 1 i.e.&amp;nbsp; the current month's dataset 102019 to&amp;nbsp; Dataset 092019&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue that I am having is --&amp;gt; End of this year December 2019 -run 1; Run 2- Jan 2020.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the macro below for the naming convention.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let mnth=%sysfunc(intnx(day,%sysfunc(today()),0,B),month.);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let yr=%sysfunc(intnx(day,%sysfunc(today()),0,B),year.);&lt;BR /&gt;%put &amp;amp;mnth&amp;amp;yr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it wont work for the year transition.. Any advice?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I am automating this. So it should work for all the years going forward, not just 2019 and 2020.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 17:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599106#M172872</guid>
      <dc:creator>ilearnsas</dc:creator>
      <dc:date>2019-10-24T17:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Naming convention for previousmonth for my sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599107#M172873</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286724"&gt;@ilearnsas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think it wont work for the year transition. Any advice?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why doesn't it work? Explain in detail. Show us the full code rather than a few lines.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 17:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599107#M172873</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-24T17:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Naming convention for previousmonth for my sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599108#M172874</link>
      <description>&lt;P&gt;Here is one way to get a macro variable with the previous month value in MMYYYY appearance.&lt;/P&gt;
&lt;P&gt;I use a data step because the number of nestings of %sysfunc needed create ugly code and some difficulty keep () straight.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   call symputx('lastmyr',put( (intnx('month',today(),-1,'b')),mmyyn6.));
run;
%put &amp;amp;lastmyr;&lt;/PRE&gt;
&lt;P&gt;And you could get the current month the same in the same data step just change the -1 to 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_; 
call symputx('lastmyr',put( (intnx('month',today(),-1,'b')),mmyyn6.)); 
call symputx('thismyr',put( (intnx('month',today(), 0,'b')),mmyyn6.)); 

run; 


%put &amp;amp;lastmyr  &amp;amp;thismyr;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Oct 2019 17:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599108#M172874</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-24T17:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Naming convention for previousmonth for my sas dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599159#M172901</link>
      <description>&lt;P&gt;Thank you so much. This worked for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 20:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Naming-convention-for-previousmonth-for-my-sas-dataset/m-p/599159#M172901</guid>
      <dc:creator>ilearnsas</dc:creator>
      <dc:date>2019-10-24T20:49:26Z</dc:date>
    </item>
  </channel>
</rss>

