<?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 yearly data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435355#M68949</link>
    <description>&lt;P&gt;you can use a macrovariable&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let sysyear= %sysfunc(year("&amp;amp;sysdate"d));&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 17:24:33 GMT</pubDate>
    <dc:creator>iscgonzalez</dc:creator>
    <dc:date>2018-02-08T17:24:33Z</dc:date>
    <item>
      <title>Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435264#M68939</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've the following datasets in SAS and for the reporting I use only the previous year dataset (&lt;SPAN&gt;test_2017&lt;/SPAN&gt;). Now I've to create a report which has data from 2016 to current year. It means I've to append the datasets (&lt;SPAN&gt;test_2016,test_2017 &amp;amp;&amp;nbsp;test_2018) to create master dataset (test_2016_to_curr_year) which I will use for my reporting.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;test_2018&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;test_2017&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;test_2016&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;test_2015&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;test_2014&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appreciate if someone guide me to write the code dynamically to achieve my requirement. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 14:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435264#M68939</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-02-08T14:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435280#M68940</link>
      <description>&lt;P&gt;You don't say how you currently combine the data but this should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set test_2016 - test_2018;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is a permanent library associated then don't forget to use the library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "dynamic" would have to be based on something to identify the start and end set but you don't really gain much if this is the only place the "dynamic" element would be used.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 15:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435280#M68940</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-08T15:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435286#M68941</link>
      <description>&lt;P&gt;I'm thinking on a macro where you can set initial and end years&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test_2016;&lt;BR /&gt;input var;&lt;BR /&gt;datalines;&lt;BR /&gt;6&lt;BR /&gt;6&lt;BR /&gt;6&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data test_2017;&lt;BR /&gt;input var;&lt;BR /&gt;datalines;&lt;BR /&gt;7&lt;BR /&gt;7&lt;BR /&gt;7&lt;BR /&gt;7&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data test_2018;&lt;BR /&gt;input var;&lt;BR /&gt;datalines;&lt;BR /&gt;8&lt;BR /&gt;8&lt;BR /&gt;8&lt;BR /&gt;8&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%macro appendtab(start,end);&lt;BR /&gt;%do i=&amp;amp;start %to &amp;amp;end;&lt;BR /&gt;proc append base=master data=test_&amp;amp;i.;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%appendtab(2016,2018);&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 15:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435286#M68941</guid>
      <dc:creator>iscgonzalez</dc:creator>
      <dc:date>2018-02-08T15:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435323#M68943</link>
      <description>I just want to append the data and also I don't want to hard code the&lt;BR /&gt;current year value(i.e. 2018) and the I want the  code to find it&lt;BR /&gt;dynamically.&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435323#M68943</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-02-08T16:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435327#M68944</link>
      <description>Is there a way to dynamically define the end year value instead of&lt;BR /&gt;hardcoding it as 2018?&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:21:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435327#M68944</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-02-08T16:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435330#M68945</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt; wrote:&lt;BR /&gt;I just want to append the data and also I don't want to hard code the&lt;BR /&gt;current year value(i.e. 2018) and the I want the code to find it&lt;BR /&gt;dynamically.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So how do you determine the current year? Todays date or something else. Note this is not a snarky question because depending on who you work with "year" could be a fiscal year, School year&amp;nbsp;which for some places a school year of "2017" means August 2016 to June 2017,&amp;nbsp;or other "year" type (are you familiar with a "water year")&amp;nbsp;which does not coincide with a calendar year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your&amp;nbsp; data "year" names do not coincide with calendars then an explicit description would be needed to map a current date available from the Today function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second part would be how to determine the "start year". Is it fixed or do you want something that allows you to very going back 2, 3, 4 or more years?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435330#M68945</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-08T16:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435355#M68949</link>
      <description>&lt;P&gt;you can use a macrovariable&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let sysyear= %sysfunc(year("&amp;amp;sysdate"d));&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 17:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435355#M68949</guid>
      <dc:creator>iscgonzalez</dc:creator>
      <dc:date>2018-02-08T17:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435376#M68955</link>
      <description>Start year is fixed and it is 2016. End year to be determined by the&lt;BR /&gt;current date.&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Feb 2018 18:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435376#M68955</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-02-08T18:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Appending yearly data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435919#M68986</link>
      <description>&lt;P&gt;If all your datasets have a common name root, appended with a 4-digit year (as in test_2015 test_2016 ....), you can read them all without knowing the actual year ranges, with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set mylib.test_: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which will read all datasets whose names begin with TEST_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This assumes there are no unwanted datasets in MYLIB&amp;nbsp; whose name begins with TEST_.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 03:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Appending-yearly-data/m-p/435919#M68986</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-02-10T03:44:57Z</dc:date>
    </item>
  </channel>
</rss>

