<?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 How to use the weekday function in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955662#M45682</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to use the weekday function based on the variable date into a calendar but with one for Saturday and so on, until 7 for Friday&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*create dataset*/
data original_data;
    format date date9.;
    input date :date9.;
    datalines;
28DEC2013
29DEC2013
30DEC2013
31DEC2013
01JAN2014
02JAN2014
03JAN2014
;
run;

data temp;
set original_data;
dayname=put(weekday(date),ENGLISH_DAY.);
daynumber=weekday(date);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 09 Jan 2025 19:37:03 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2025-01-09T19:37:03Z</dc:date>
    <item>
      <title>How to use the weekday function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955662#M45682</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to use the weekday function based on the variable date into a calendar but with one for Saturday and so on, until 7 for Friday&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*create dataset*/
data original_data;
    format date date9.;
    input date :date9.;
    datalines;
28DEC2013
29DEC2013
30DEC2013
31DEC2013
01JAN2014
02JAN2014
03JAN2014
;
run;

data temp;
set original_data;
dayname=put(weekday(date),ENGLISH_DAY.);
daynumber=weekday(date);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jan 2025 19:37:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955662#M45682</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2025-01-09T19:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the weekday function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955665#M45684</link>
      <description>&lt;P&gt;This is simply a mathematical adjustment of variable DAYNUMBER&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;daynumber=weekday(date);
daynumber_adjusted=daynumber+1;
if daynumber_adjusted=8 then daynumber_adjusted=1;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jan 2025 19:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955665#M45684</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-01-09T19:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the weekday function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955666#M45685</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need this modified WEEKDAY function multiple times in your programs, you may want to create your own function ("MYWEEKDAY")&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.funcs.test;
function myweekday(date);
  return(mod(weekday(date),7)+1);
endsub;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usage example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options cmplib=work.funcs;

data _null_;
set original_data;
wd=myweekday(date);
put wd date weekdate.-l;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;1 Saturday, December 28, 2013
2 Sunday, December 29, 2013
3 Monday, December 30, 2013
4 Tuesday, December 31, 2013
5 Wednesday, January 1, 2014
6 Thursday, January 2, 2014
7 Friday, January 3, 2014&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Jan 2025 20:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-the-weekday-function/m-p/955666#M45685</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-01-09T20:01:12Z</dc:date>
    </item>
  </channel>
</rss>

