<?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: Is there a SAS function which returns the month based on the week identifier? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751664#M29700</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281554"&gt;@PierreYvesILY&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could pick one of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/allprodsle/syntaxByType-informat.htm#p0yi5zqorv0kf3n1wjgzp53i09zmn1v0ez0x2x99qdn15797taed37ji" target="_blank" rel="noopener"&gt;WEEK... informats&lt;/A&gt; and use the MONTH, INPUT, CATS and PUT functions to compute the month from week number &lt;EM&gt;and year&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
do week=26 to 27;
  do year=2019 to 2021;
    mon=month(input(cats(year,'W',put(week,z2.)),weekv.));
    output;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;week    year    mon

 26     2019     6
 26     2020     6
 26     2021     6
 27     2019     7
 27     2020     &lt;STRONG&gt;6&lt;/STRONG&gt;
 27     2021     7&lt;/PRE&gt;
&lt;P&gt;In this example the month is (by default) calculated for the &lt;EM&gt;Monday&lt;/EM&gt; of the respective week.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Jul 2021 09:41:00 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-07-02T09:41:00Z</dc:date>
    <item>
      <title>Is there a SAS function which returns the month based on the week identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751645#M29696</link>
      <description>&lt;P&gt;Is there a SAS function which returns the month based on the week identifier?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ex.: Week 26 =&amp;gt; 06&lt;/P&gt;&lt;P&gt;or&amp;nbsp; &amp;nbsp; Week 26 =&amp;gt; JUNE&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 08:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751645#M29696</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-07-02T08:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS function which returns the month based on the week identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751649#M29697</link>
      <description>&lt;P&gt;Not that I know of.&lt;/P&gt;
&lt;P&gt;Since a week can be split between two months, you need to figure how you want to map this.&lt;/P&gt;
&lt;P&gt;So I think that you need to go via a date first.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 08:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751649#M29697</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2021-07-02T08:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS function which returns the month based on the week identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751653#M29698</link>
      <description>&lt;P&gt;I believe what you're asking for is not possible without also knowing the year AND the logic used to determine the first day of week 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For below found here:&amp;nbsp;&lt;A href="https://www.epochconverter.com/weeks/2020" target="_blank"&gt;https://www.epochconverter.com/weeks/2020&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1625214474568.png" style="width: 567px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60897i738DB0F83AA7CF1D/image-dimensions/567x119?v=v2" width="567" height="119" role="button" title="Patrick_0-1625214474568.png" alt="Patrick_0-1625214474568.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1625214621690.png" style="width: 631px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60898i14FF3C3C755D8CC4/image-dimensions/631x116?v=v2" width="631" height="116" role="button" title="Patrick_1-1625214621690.png" alt="Patrick_1-1625214621690.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without a year what month should week 1 get - and what month week 52 or 53?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 08:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751653#M29698</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-02T08:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS function which returns the month based on the week identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751664#M29700</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/281554"&gt;@PierreYvesILY&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could pick one of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/allprodsle/syntaxByType-informat.htm#p0yi5zqorv0kf3n1wjgzp53i09zmn1v0ez0x2x99qdn15797taed37ji" target="_blank" rel="noopener"&gt;WEEK... informats&lt;/A&gt; and use the MONTH, INPUT, CATS and PUT functions to compute the month from week number &lt;EM&gt;and year&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
do week=26 to 27;
  do year=2019 to 2021;
    mon=month(input(cats(year,'W',put(week,z2.)),weekv.));
    output;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;week    year    mon

 26     2019     6
 26     2020     6
 26     2021     6
 27     2019     7
 27     2020     &lt;STRONG&gt;6&lt;/STRONG&gt;
 27     2021     7&lt;/PRE&gt;
&lt;P&gt;In this example the month is (by default) calculated for the &lt;EM&gt;Monday&lt;/EM&gt; of the respective week.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 09:41:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751664#M29700</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-07-02T09:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a SAS function which returns the month based on the week identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751698#M29706</link>
      <description>&lt;P&gt;hey Reinhard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot for this very good solution, which is exactly what I was looking for!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just modified my program with it and tested it, it's just perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a nice WE&lt;/P&gt;&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;PY&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 11:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Is-there-a-SAS-function-which-returns-the-month-based-on-the/m-p/751698#M29706</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-07-02T11:02:59Z</dc:date>
    </item>
  </channel>
</rss>

