<?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 Value of Weekday Number in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587692#M34626</link>
    <description>&lt;P&gt;Assuming you're using a calculated field in the query builder?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try some basic math then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;8 - weekday(datepart(dateVariable))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm assuming you're using DATEPART to first convert your datetime to a date and then you use the WEEKDAY function or format to create your dates?&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/165310"&gt;@RPYee&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a series of dates for which I need to determine the day of week said date falls on, sum a value for each day of week (pivot), and sort totals from Monday thru Sunday.&amp;nbsp; I have a calculated field (day_nbr) which uses "datepart" and is formatted as "Weekday1.".&amp;nbsp; It automatically sets Sunday as a value of 1 when I need it to be 7.&amp;nbsp; I tried a case statement testing "day_nbr", but it's not working.&amp;nbsp; Any suggestions on how to make the day_nbr for Sunday be 7, then subtract one from all the others, for grouping purposes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for any assistance!&lt;/P&gt;
&lt;P&gt;Rita Yee&lt;/P&gt;
&lt;P&gt;Project Engineer&lt;/P&gt;
&lt;P&gt;Global Trade Services&lt;/P&gt;
&lt;P&gt;FedEx Express&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 22:26:17 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-09-10T22:26:17Z</dc:date>
    <item>
      <title>Change Value of Weekday Number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587683#M34623</link>
      <description>&lt;P&gt;I have a series of dates for which I need to determine the day of week said date falls on, sum a value for each day of week (pivot), and sort totals from Monday thru Sunday.&amp;nbsp; I have a calculated field (day_nbr) which uses "datepart" and is formatted as "Weekday1.".&amp;nbsp; It automatically sets Sunday as a value of 1 when I need it to be 7.&amp;nbsp; I tried a case statement testing "day_nbr", but it's not working.&amp;nbsp; Any suggestions on how to make the day_nbr for Sunday be 7, then subtract one from all the others, for grouping purposes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for any assistance!&lt;/P&gt;&lt;P&gt;Rita Yee&lt;/P&gt;&lt;P&gt;Project Engineer&lt;/P&gt;&lt;P&gt;Global Trade Services&lt;/P&gt;&lt;P&gt;FedEx Express&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 21:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587683#M34623</guid>
      <dc:creator>RPYee</dc:creator>
      <dc:date>2019-09-10T21:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change Value of Weekday Number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587685#M34624</link>
      <description>&lt;P&gt;For grouping purposes, any assignment of the numbers 1 through 7 ought to work.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 21:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587685#M34624</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-09-10T21:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change Value of Weekday Number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587686#M34625</link>
      <description>&lt;P&gt;Hi, Rita&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS has a feature called "picture" formats. Believe it or not, the day of week default is 1 for Monday. This code snippet should help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	picture dwf
		low-high = '%u' (datatype=date);
run;

data Have;
	InDay = '9sep2019:00:00:00'dt;
	format InDay datetime.;
	day_nbr = datepart(InDay);
	format day_nbr dwf.;
	output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 21:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587686#M34625</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2019-09-10T21:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change Value of Weekday Number</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587692#M34626</link>
      <description>&lt;P&gt;Assuming you're using a calculated field in the query builder?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try some basic math then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;8 - weekday(datepart(dateVariable))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm assuming you're using DATEPART to first convert your datetime to a date and then you use the WEEKDAY function or format to create your dates?&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/165310"&gt;@RPYee&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a series of dates for which I need to determine the day of week said date falls on, sum a value for each day of week (pivot), and sort totals from Monday thru Sunday.&amp;nbsp; I have a calculated field (day_nbr) which uses "datepart" and is formatted as "Weekday1.".&amp;nbsp; It automatically sets Sunday as a value of 1 when I need it to be 7.&amp;nbsp; I tried a case statement testing "day_nbr", but it's not working.&amp;nbsp; Any suggestions on how to make the day_nbr for Sunday be 7, then subtract one from all the others, for grouping purposes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for any assistance!&lt;/P&gt;
&lt;P&gt;Rita Yee&lt;/P&gt;
&lt;P&gt;Project Engineer&lt;/P&gt;
&lt;P&gt;Global Trade Services&lt;/P&gt;
&lt;P&gt;FedEx Express&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 22:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-Value-of-Weekday-Number/m-p/587692#M34626</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-10T22:26:17Z</dc:date>
    </item>
  </channel>
</rss>

