<?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: Change into Quarter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443997#M111112</link>
    <description>&lt;P&gt;Here is the type&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SVC_SFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_FFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_CY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_SFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_FFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_CY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Fri, 09 Mar 2018 05:31:17 GMT</pubDate>
    <dc:creator>Ahsan</dc:creator>
    <dc:date>2018-03-09T05:31:17Z</dc:date>
    <item>
      <title>Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443986#M111109</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just need some help&amp;nbsp;I need to change the date into quarters. How do we do this please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SVC_END_DT&lt;/TD&gt;&lt;TD&gt;Use the srvc_end_dt for derving quarter baased on type of qtr (State, Federal or calendar) . Date - Jul 1, 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_END_DT&lt;/TD&gt;&lt;TD&gt;Use the srvc_end_dt for derving quarter baased on type of qtr (State, Federal or calendar). Date Oct 1 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_END_DT&lt;/TD&gt;&lt;TD&gt;Use the srvc_end_dt for derving quarter baased on type of qtr (State, Federal or calendar) . Date Jan 1 2018 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CLM_HDR_PD_DT&lt;/TD&gt;&lt;TD&gt;Use the paid date for derving quarter baased on type of qtr (State, Federal or calendar) . Date - Jul 1, 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CLM_HDR_PD_DT&lt;/TD&gt;&lt;TD&gt;Use the paid_dt for derving quarter baased on type of qtr (State, Federal or calendar). Date Oct 1 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CLM_HDR_PD_DT&lt;/TD&gt;&lt;TD&gt;Use the paid_dt for derving quarter baased on type of qtr (State, Federal or calendar) . Date Jan 1 2018 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 05:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443986#M111109</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-09T05:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443995#M111111</link>
      <description>&lt;P&gt;Please define the types of qtr. Where would you find which type to use?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 05:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443995#M111111</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-09T05:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443997#M111112</link>
      <description>&lt;P&gt;Here is the type&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SVC_SFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_FFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_CY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_SFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_FFY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_CY_QTR&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 05:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/443997#M111112</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-09T05:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444004#M111113</link>
      <description>&lt;P&gt;Please define the types of qtr (State, Federal, calendar). What would these _QTR variables contain?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 05:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444004#M111113</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-09T05:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444006#M111115</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SVC_SFY_QTR= State Fiscal Year Use the srvc_end_dt for derving quarter baased on type of qtr (State, Federal or calendar) . Date - Jul 1, 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_FFY_QTR= State Federal Fiscal Year Use the srvc_end_dt for derving quarter baased on type of qtr (State, Federal or calendar). Date Oct 1 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;SVC_CY_QTR= State Calendar Year Use the srvc_end_dt for derving quarter baased on type of qtr (State, Federal or calendar) . Date Jan 1 2018 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_SFY_QTR= State Fiscal Year Use the paid date for derving quarter baased on type of qtr (State, Federal or calendar) . Date - Jul 1, 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_FFY_QTR=State Federal Fiscal Year Use the paid_dt for derving quarter baased on type of qtr (State, Federal or calendar). Date Oct 1 2017 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PAID_CY_QTR= State Calendar Year Use the paid_dt for derving quarter baased on type of qtr (State, Federal or calendar) . Date Jan 1 2018 = 2018Q1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 05:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444006#M111115</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-09T05:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444011#M111116</link>
      <description>&lt;P&gt;Use the&lt;STRONG&gt; intnx&lt;/STRONG&gt; function with the appropriate interval and shift. Have your pick:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
do year = 2017, 2018;
    do month = 1 to 12;
        date = mdy(month,1,year);
        q1 = intnx("QTR3.1", date, 0);        
        q2 = intnx("QTR3.2", date, 0);        
        q3 = intnx("QTR3.3", date, 0);
        q4 = intnx("QTR3.4", date, 0);
        q1_1 = intnx("QTR3.1", date, 1);        
        q2_1 = intnx("QTR3.2", date, 1);        
        q3_1 = intnx("QTR3.3", date, 1);
        q4_1 = intnx("QTR3.4", date, 1);
        output;
        end;
    end;
format date yymmdd10. q: yyq.;
drop year month;
run;

proc print noobs; run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;       date     q1       q2       q3       q4      q1_1     q2_1     q3_1     q4_1

 2017-01-01   2017Q1   2016Q2   2016Q2   2016Q3   2017Q4   2017Q1   2017Q1   2017Q2
 2017-02-01   2017Q1   2017Q1   2016Q2   2016Q3   2017Q4   2017Q4   2017Q1   2017Q2
 2017-03-01   2017Q1   2017Q1   2017Q1   2016Q3   2017Q4   2017Q4   2017Q4   2017Q2
 2017-04-01   2017Q1   2017Q1   2017Q1   2017Q2   2017Q4   2017Q4   2017Q4   2018Q1
 2017-05-01   2017Q1   2017Q1   2017Q1   2017Q2   2017Q4   2017Q4   2017Q4   2018Q1
 2017-06-01   2017Q1   2017Q1   2017Q1   2017Q2   2017Q4   2017Q4   2017Q4   2018Q1
 2017-07-01   2017Q1   2017Q1   2017Q1   2017Q2   2017Q4   2017Q4   2017Q4   2018Q1
 2017-08-01   2017Q1   2017Q1   2017Q1   2017Q2   2017Q4   2017Q4   2017Q4   2018Q1
 2017-09-01   2017Q1   2017Q1   2017Q1   2017Q2   2017Q4   2017Q4   2017Q4   2018Q1
 2017-10-01   2017Q4   2017Q1   2017Q1   2017Q2   2018Q3   2017Q4   2017Q4   2018Q1
 2017-11-01   2017Q4   2017Q4   2017Q1   2017Q2   2018Q3   2018Q3   2017Q4   2018Q1
 2017-12-01   2017Q4   2017Q4   2017Q4   2017Q2   2018Q3   2018Q3   2018Q3   2018Q1
 2018-01-01   2017Q4   2017Q4   2017Q4   2018Q1   2018Q3   2018Q3   2018Q3   2018Q4
 2018-02-01   2017Q4   2017Q4   2017Q4   2018Q1   2018Q3   2018Q3   2018Q3   2018Q4
 2018-03-01   2017Q4   2017Q4   2017Q4   2018Q1   2018Q3   2018Q3   2018Q3   2018Q4
 2018-04-01   2017Q4   2017Q4   2017Q4   2018Q1   2018Q3   2018Q3   2018Q3   2018Q4
 2018-05-01   2017Q4   2017Q4   2017Q4   2018Q1   2018Q3   2018Q3   2018Q3   2018Q4
 2018-06-01   2017Q4   2017Q4   2017Q4   2018Q1   2018Q3   2018Q3   2018Q3   2018Q4
 2018-07-01   2018Q3   2017Q4   2017Q4   2018Q1   2019Q2   2018Q3   2018Q3   2018Q4
 2018-08-01   2018Q3   2018Q3   2017Q4   2018Q1   2019Q2   2019Q2   2018Q3   2018Q4
 2018-09-01   2018Q3   2018Q3   2018Q3   2018Q1   2019Q2   2019Q2   2019Q2   2018Q4
 2018-10-01   2018Q3   2018Q3   2018Q3   2018Q4   2019Q2   2019Q2   2019Q2   2019Q3
 2018-11-01   2018Q3   2018Q3   2018Q3   2018Q4   2019Q2   2019Q2   2019Q2   2019Q3
 2018-12-01   2018Q3   2018Q3   2018Q3   2018Q4   2019Q2   2019Q2   2019Q2   2019Q3
&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Mar 2018 06:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444011#M111116</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-09T06:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444074#M111131</link>
      <description>&lt;P&gt;do you think it's a&amp;nbsp;right format for the quarters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for SVC_SFY_QTR&lt;/P&gt;&lt;P&gt;INTNX('QTR', 't1.SVC_END_DT', 1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date - Jul 1, 2017 = 2018Q1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is it right approach&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 13:32:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444074#M111131</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-09T13:32:50Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444285#M111199</link>
      <description>&lt;P&gt;Please can somebody help me out with date issue.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 21:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444285#M111199</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-09T21:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444290#M111202</link>
      <description>&lt;P&gt;Have you tried to understand the code &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;posted? There isn't much to add to this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're still struggling: Post representative sample data (in the form of a working SAS data step creating this data) and then tell us how the desired result should look like based on the sample data posted.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Mar 2018 22:17:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444290#M111202</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-09T22:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444409#M111259</link>
      <description>&lt;P&gt;DBA send me his code&lt;/P&gt;&lt;P&gt;(case when to_char(ch.SVC_END_DT, 'MM') &amp;gt; '06' and to_char(ch.SVC_END_DT, 'MM') &amp;lt; '10' then to_char(to_number(to_char(ch.SVC_END_DT,'YYYY')) + 1)||'Q1'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when to_char(ch.SVC_END_DT, 'MM') &amp;gt; '09' then to_char(to_number(to_char(ch.SVC_END_DT,'YYYY')) + 1)||'Q2'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when to_char(ch.SVC_END_DT, 'MM') &amp;lt; '04' then to_char(to_number(to_char(ch.SVC_END_DT,'YYYY')))||'Q3'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when to_char(ch.SVC_END_DT, 'MM') &amp;gt; '03' and to_char(ch.SVC_END_DT, 'MM') &amp;lt; '07' then to_char(to_number(to_char(ch.SVC_END_DT,'YYYY')))||'Q4'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; else null end) SVC_SFY_QTR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how do I change it into SAS and validate. All the help appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 16:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444409#M111259</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-10T16:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444447#M111276</link>
      <description>Can somebody help me out with this code how do I convert into SAS.&lt;BR /&gt;&lt;BR /&gt;Thank You</description>
      <pubDate>Sat, 10 Mar 2018 20:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444447#M111276</guid>
      <dc:creator>Ahsan</dc:creator>
      <dc:date>2018-03-10T20:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Change into Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444486#M111297</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165195"&gt;@Ahsan&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;What is it that you don't understand? The SAS code &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;already posted or the Oracle SQL the DBA shared with you?&lt;/P&gt;
&lt;P&gt;Going forward you will need to spend a bit more time to formulate targeted questions. Just "help me out" could be understood as "just do all the work for me" and that's not what this forum is for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But o.k. it's only your second post here. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;actually provides already the SAS solution (you just need to pick the appropriate case) but here another variant on how to implement in SAS the logic from the Oracle SQL.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  input SVC_END_DT anydtdtm.;
  format SVC_END_DT datetime21.;
  SVC_SFY_QTR=put(intnx('quarter',datepart(SVC_END_DT),+2,'s'),yyq6.);
datalines;
15jan2017
31mar2017
01apr2017
30jun2017
01jul2017
30sep2017
15oct2017
31dec2017
01jan2018
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Mar 2018 00:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-into-Quarter/m-p/444486#M111297</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-11T00:42:02Z</dc:date>
    </item>
  </channel>
</rss>

