<?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: Formats showing wrong weekday. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492301#M129350</link>
    <description>Thank's Kurt. As it is said in German: "Den Wald vor lauter Bäumen nicht mehr sehen!"</description>
    <pubDate>Tue, 04 Sep 2018 14:05:30 GMT</pubDate>
    <dc:creator>FK1</dc:creator>
    <dc:date>2018-09-04T14:05:30Z</dc:date>
    <item>
      <title>Formats showing wrong weekday.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492232#M129327</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I read in the SAS Online Documentation regarding the "weekday-function" the following:&lt;BR /&gt;"The WEEKDAY function produces an integer that represents the day of the week, where 1=Sunday, 2=Monday, ..., 7=Saturday."&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;When I run the following code, I get WRONG weekdays as soon as I put a weekday-Format on the calculated weekday.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data input;
format date date9.  ;
input date ;
datalines;
21400
21401
21402
21403
21404
;

 
run;

data weekdays_wrong;
set input;
weekday  = weekday(date);
weekday2 = weekday(date);
weekday3 = weekday(date);
format weekday2 weekday9. weekday3  weekdate9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Correctly, the &lt;STRONG&gt;4th of August 2018&lt;/STRONG&gt; was a &lt;STRONG&gt;SATURDAY (which corresponds to the integer "7", so the weekday-function works!) . But SAS assigns a Friday (integer = "6") as soon as I want to put a format - no matter if I use "weekday9." or "weekdate9." for example -&amp;nbsp; on the calculated weekday!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing? Does it have to do something with the Nation Language Support?&amp;nbsp; I would like to get the weekdays in German language (I think, I have to use the "NLDATEWN" format)? Would that mean, that I have to set the option&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options LOCALE=DE_DE; &lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By default, we have set options LOCALE=US_EN. I vaguely remember that Americans vs. Germans start counting the week by a 1 day difference.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would gladly be appreciated.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;FK1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 09:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492232#M129327</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2018-09-04T09:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Formats showing wrong weekday.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492233#M129328</link>
      <description>&lt;P&gt;You are missing the fact that the formats need to be applied to a &lt;EM&gt;date&lt;/EM&gt;, not a &lt;EM&gt;weekday number&lt;/EM&gt;. If you use those formats on a weekday number, you get the weekdays of the first seven days of 1960.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 09:15:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492233#M129328</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-04T09:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Formats showing wrong weekday.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492301#M129350</link>
      <description>Thank's Kurt. As it is said in German: "Den Wald vor lauter Bäumen nicht mehr sehen!"</description>
      <pubDate>Tue, 04 Sep 2018 14:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492301#M129350</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2018-09-04T14:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Formats showing wrong weekday.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492303#M129351</link>
      <description>&lt;P&gt;Passiert jedem mal.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 14:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formats-showing-wrong-weekday/m-p/492303#M129351</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-04T14:07:28Z</dc:date>
    </item>
  </channel>
</rss>

