<?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: Converting DATE YYYYMMDD10 to an academic year value in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474217#M30762</link>
    <description>&lt;P&gt;Did the code produce what you want then?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88036"&gt;@runningjay&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes - it is a numeric field with a date format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jun 2018 19:29:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-28T19:29:51Z</dc:date>
    <item>
      <title>Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474101#M30746</link>
      <description>&lt;P&gt;I'm relatively new to SAS and I'm trying to create a new field based on the value in a variable titled STARTDATE formattted as DATE YYYYMMDD10. I want to use this variable to calculate a new variable labeled "FISCALYR". I need only the YYYY for this new variable, but I want it to be based on a fiscal year that runs from 07/01 to 06/30.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As an example if the STARTDATE is 20100625 I want the FISCALFY to reflect 2010. If the STARTDATE is 20100703 I want the FISCALFY to reflect 2011. I was thinking I could use the INTCK or INTNX functions, but I'm not sure how to make this work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the feedback!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474101#M30746</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-07-02T15:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474112#M30747</link>
      <description>&lt;P&gt;What type and format are the date variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are they numeric with a format applied such as yymmdd10, or are they a character and appear as 2018/06/28?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 15:15:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474112#M30747</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-28T15:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474113#M30748</link>
      <description>&lt;P&gt;Before going any further please confirm that your Startdate variable is 1) numeric and 2) has an actual SAS Format of yymmdd10. If the SAS format is not a date format displaying the values the way you want then your value is basically just a number and the Date related functions and such will not work. Use proc contents or the SAS explorer to view column properties or such. I ask for clarification because there is no SAS supplied format yyyymmdd10. There is yymmdd10. however.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF the value is a SAS date value then&lt;/P&gt;
&lt;P&gt;Fiscalyear = year(datevariable) + (month(datevariable) &amp;gt; 6);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input date mmddyy10.;
   format date yymmdd10.;
   Fiscalyear = year(date) + (month(date) &amp;gt; 6);
datalines;
01/01/2016
06/20/2016
07/01/2016
;
run;&lt;/PRE&gt;
&lt;P&gt;If your variable is not a date then you likely should actually turn it into an actual SAS date value as that makes things much easier. Best is usually to do so while reading or importing data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 15:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474113#M30748</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-28T15:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474140#M30757</link>
      <description>&lt;P&gt;I should have stated more clearly. The STARTDATE is a DATE field with a format of YYMMDD10., not YYYYMMDD10. as stated previously.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 15:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474140#M30757</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-06-28T15:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474145#M30758</link>
      <description>&lt;P&gt;Not being a pain, just a clarification, SAS only has two types, numeric and character. So its a numeric with a date format or a character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to assume it's a date though in this case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the YEAR function to get the year component and the MONTH() function to get the month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if month(date) &amp;lt;= 6 then fiscal_Year = catx('/', year(date)-1, year(date));
else fiscal_year = catx('/', year(date), year(date)+1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 16:06:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474145#M30758</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-28T16:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474155#M30759</link>
      <description>&lt;P&gt;Yes - it is a numeric field with a date format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 16:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474155#M30759</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-06-28T16:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474217#M30762</link>
      <description>&lt;P&gt;Did the code produce what you want then?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88036"&gt;@runningjay&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes - it is a numeric field with a date format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 19:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474217#M30762</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-28T19:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474942#M30808</link>
      <description>&lt;P&gt;Thanks for the suggestion and guidance. Both of the responses I received worked to achieve what I wanted to do including your suggestion. In looking back at my question I should have been more clear in what I was trying to do, but even with the lack of clarity you provided excellent guidance that provided what I needed. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474942#M30808</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-07-02T15:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DATE YYYYMMDD10 to an academic year value</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474945#M30809</link>
      <description>&lt;P&gt;Final solution I used was as follows:&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;month&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;6&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; fiscal_Year &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;catx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'/'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;-1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; fiscal_year &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;catx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'/'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This provided the FISCAL YEAR formatted as needed. Thanks for the feedback especially given the lack of clarity in my original question.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 15:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Converting-DATE-YYYYMMDD10-to-an-academic-year-value/m-p/474945#M30809</guid>
      <dc:creator>runningjay</dc:creator>
      <dc:date>2018-07-02T15:28:00Z</dc:date>
    </item>
  </channel>
</rss>

