<?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 Flexible fiscal week from date column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flexible-fiscal-week-from-date-column/m-p/903053#M356867</link>
    <description>&lt;P&gt;In the given sample dataset, I’m adding fiscal week from a date column “TX_DT”. The fiscal year runs from Feb through Jan in a given year, for example, if we consider FY2022 (Feb’22 – Jan’23), 2022-02-01 will be fiscal week 1 and 2023-01-31 will be fiscal week 52. I’m using the code below to add fiscal week, however, the dates ranging between 2023-02-01 and 2023-02-05 are assigned 0 for their fiscal week. Dates post 2023-02-05 are assigned fiscal week 1 and so on….How can I make sure that my fiscal week starts from 2023-02-01. Also, this code starts the fiscal week from Saturday through Sunday. What changes can be made in the code if the fiscal week were to run from Monday through Sunday?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data temp_summ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales_Yearmon = year(TX_DT)*100 + month(TX_DT);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_normal = week(TX_DT);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dat2 = intnx('month12.2',TX_DT,0);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_F = intck('week',dat2,TX_DT);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format dat2 date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that the date column “TX_DT” is of numeric data type of ‘YYMMDD10.’ Format and ‘YYMMDD10.’ Informat.&lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2023 20:07:09 GMT</pubDate>
    <dc:creator>hk24</dc:creator>
    <dc:date>2023-11-14T20:07:09Z</dc:date>
    <item>
      <title>Flexible fiscal week from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flexible-fiscal-week-from-date-column/m-p/903053#M356867</link>
      <description>&lt;P&gt;In the given sample dataset, I’m adding fiscal week from a date column “TX_DT”. The fiscal year runs from Feb through Jan in a given year, for example, if we consider FY2022 (Feb’22 – Jan’23), 2022-02-01 will be fiscal week 1 and 2023-01-31 will be fiscal week 52. I’m using the code below to add fiscal week, however, the dates ranging between 2023-02-01 and 2023-02-05 are assigned 0 for their fiscal week. Dates post 2023-02-05 are assigned fiscal week 1 and so on….How can I make sure that my fiscal week starts from 2023-02-01. Also, this code starts the fiscal week from Saturday through Sunday. What changes can be made in the code if the fiscal week were to run from Monday through Sunday?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data temp_summ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales_Yearmon = year(TX_DT)*100 + month(TX_DT);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_normal = week(TX_DT);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dat2 = intnx('month12.2',TX_DT,0);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; week_F = intck('week',dat2,TX_DT);&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format dat2 date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note that the date column “TX_DT” is of numeric data type of ‘YYMMDD10.’ Format and ‘YYMMDD10.’ Informat.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 20:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flexible-fiscal-week-from-date-column/m-p/903053#M356867</guid>
      <dc:creator>hk24</dc:creator>
      <dc:date>2023-11-14T20:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Flexible fiscal week from date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flexible-fiscal-week-from-date-column/m-p/903055#M356868</link>
      <description>&lt;P&gt;Look at the V descriptor option for the WEEK function.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 20:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flexible-fiscal-week-from-date-column/m-p/903055#M356868</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-11-14T20:35:45Z</dc:date>
    </item>
  </channel>
</rss>

