<?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: Week Function, Changing the value of the descriptor in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179092#M45725</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick and dirty I would create a new variable using the date shifted by one day. &lt;/P&gt;&lt;P&gt;MyWeek= week((sasdate-1));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Jan 2015 18:58:08 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-01-12T18:58:08Z</dc:date>
    <item>
      <title>Week Function, Changing the value of the descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179091#M45724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Given the syntax of&amp;nbsp; &lt;SPAN class="strong"&gt;WEEK&lt;/SPAN&gt;(&amp;lt;&lt;SPAN class="emph"&gt;sas-date&lt;/SPAN&gt;&amp;gt;, &amp;lt;&lt;SPAN class="emph"&gt;'descriptor'&lt;/SPAN&gt;&amp;gt;) for the week function and "U" being Sunday as first day of week and "W" being Monday as first day of week, is it possible to change these or create a custom descriptor to set the start of the week to Saturday?&amp;nbsp; I have a report that I am creating where currently it reports stats on a weekly basis starting on Sunday and running through Saturday.&amp;nbsp; The recipient of the report would like the report to run from Saturday and end on Friday. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 18:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179091#M45724</guid>
      <dc:creator>DougJ</dc:creator>
      <dc:date>2015-01-12T18:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Week Function, Changing the value of the descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179092#M45725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quick and dirty I would create a new variable using the date shifted by one day. &lt;/P&gt;&lt;P&gt;MyWeek= week((sasdate-1));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 18:58:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179092#M45725</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-01-12T18:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Week Function, Changing the value of the descriptor</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179093#M45726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found this in a white paper online, initial testing appears to be working for shifting the start of the week for the date ranges.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.pharmasug.org/proceedings/2012/CC/PharmaSUG-2012-CC19.pdf"&gt;http://www.pharmasug.org/proceedings/2012/CC/PharmaSUG-2012-CC19.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NON-TRADITIONAL WEEKS&lt;/P&gt;&lt;P&gt;The quickest way to group weeks with a start date other than Sunday is by using Shift Operators &lt;/P&gt;&lt;P&gt;with the INTNX function. If you recall the first parameter specified in the INTNX function is the &lt;/P&gt;&lt;P&gt;interval. Multipliers and shift indexes can be used with the basic interval names to construct more &lt;/P&gt;&lt;P&gt;complex intervals. When using multipliers and shift indexes your interval name will have the &lt;/P&gt;&lt;P&gt;format: NAMEm.s&lt;/P&gt;&lt;P&gt;NAME&amp;nbsp;&amp;nbsp;&amp;nbsp; is the basic interval time. In our case, it would be WEEK&lt;/P&gt;&lt;P&gt;m&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; is an optional multiplier which multiplies the interval by the specified value. For &lt;/P&gt;&lt;P&gt;example, the interval WEEK2 consists of two-week periods.&lt;/P&gt;&lt;P&gt;S&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; is an optional starting point for the interval. By default, the WEEK interval starts on &lt;/P&gt;&lt;P&gt;Sunday with Sunday=1. So if you want a week to start on Wednesday (value =4) then the interval &lt;/P&gt;&lt;P&gt;would be WEEK.4 .&lt;/P&gt;&lt;P&gt;Both the multipliers and shift index are optional and default to 1. So the intervals, &lt;/P&gt;&lt;P&gt;WEEK,WEEK1.1,WEEK.1 are all equivalent to the basic week interval. Different intervals are shifted &lt;/P&gt;&lt;P&gt;by different subperiods. For our purposes, week is shifted by days. Also the shift index cannot be &lt;/P&gt;&lt;P&gt;greater than the number of subperiods in the whole interval (so no greater than 7).&lt;/P&gt;&lt;P&gt;For example, let’s take our last3weeks dataset but define the weeks to start on Thursdays:&lt;/P&gt;&lt;P&gt;DATA last3weeks; SET last3weeks;&lt;/P&gt;&lt;P&gt;start = intnx('week.5',trans_date,0,'beginning'); end = intnx('week.5',trans_date,0,'end');&lt;/P&gt;&lt;P&gt;ThuWeeks = catx(' - ', PUT(start2,mmddyy8.),put(end2,mmddyy8.));&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 19:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Week-Function-Changing-the-value-of-the-descriptor/m-p/179093#M45726</guid>
      <dc:creator>DougJ</dc:creator>
      <dc:date>2015-01-12T19:19:02Z</dc:date>
    </item>
  </channel>
</rss>

