<?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: Transforming from monthly to weekly variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895903#M353968</link>
    <description>&lt;P&gt;There is no exact unambiguous and clearly agreed upon method of turning months into weeks. If you can state, in words, exactly how you want to do it, we can help code it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The whole thing would be easier if months and weeks were stored as data in the variables, instead of having months and weeks stored in variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeating: please provide data as working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;Examples and instructions&lt;/A&gt;).&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2023 14:00:09 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-09-26T14:00:09Z</dc:date>
    <item>
      <title>Transforming from monthly to weekly variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895902#M353967</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this type of data:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;person&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;variable_2020_01&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;variable_2020_02&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;A&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;1&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;B&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;6&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I need it transformed into weekly data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="1639px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="67.8594px"&gt;person&lt;/TD&gt;
&lt;TD width="193.484px"&gt;weekly_variable_2020_01&lt;/TD&gt;
&lt;TD width="196.281px"&gt;weekly_variable_2020_02&lt;/TD&gt;
&lt;TD width="196.641px"&gt;weekly_variable_2020_03&lt;/TD&gt;
&lt;TD width="197.5px"&gt;weekly_variable_2020_04&lt;/TD&gt;
&lt;TD width="196.422px"&gt;weekly_variable_2020_05&lt;/TD&gt;
&lt;TD width="196.75px"&gt;weekly_variable_2020_06&lt;/TD&gt;
&lt;TD width="196.281px"&gt;weekly_variable_2020_07&lt;/TD&gt;
&lt;TD width="196.781px"&gt;weekly_variable_2020_08&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67.8594px"&gt;A&lt;/TD&gt;
&lt;TD width="193.484px"&gt;1&lt;/TD&gt;
&lt;TD width="196.281px"&gt;1&lt;/TD&gt;
&lt;TD width="196.641px"&gt;1&lt;/TD&gt;
&lt;TD width="197.5px"&gt;1&lt;/TD&gt;
&lt;TD width="196.422px"&gt;5&lt;/TD&gt;
&lt;TD width="196.75px"&gt;5&lt;/TD&gt;
&lt;TD width="196.281px"&gt;5&lt;/TD&gt;
&lt;TD width="196.781px"&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="67.8594px"&gt;B&lt;/TD&gt;
&lt;TD width="193.484px"&gt;6&lt;/TD&gt;
&lt;TD width="196.281px"&gt;6&lt;/TD&gt;
&lt;TD width="196.641px"&gt;6&lt;/TD&gt;
&lt;TD width="197.5px"&gt;6&lt;/TD&gt;
&lt;TD width="196.422px"&gt;8&lt;/TD&gt;
&lt;TD width="196.75px"&gt;8&lt;/TD&gt;
&lt;TD width="196.281px"&gt;8&lt;/TD&gt;
&lt;TD width="196.781px"&gt;8&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realise that I have two problems:&lt;/P&gt;
&lt;P&gt;1) I don't know how to code this in a away that just assumes 4 weeks=1month&lt;/P&gt;
&lt;P&gt;2) 4 weeks doesn't always equal 1 month&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I am hoping that someone has experience with this dilemma and is able to help me.&lt;/P&gt;
&lt;P&gt;Thank a lot! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 13:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895902#M353967</guid>
      <dc:creator>niki0209</dc:creator>
      <dc:date>2023-09-26T13:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming from monthly to weekly variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895903#M353968</link>
      <description>&lt;P&gt;There is no exact unambiguous and clearly agreed upon method of turning months into weeks. If you can state, in words, exactly how you want to do it, we can help code it for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The whole thing would be easier if months and weeks were stored as data in the variables, instead of having months and weeks stored in variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeating: please provide data as working SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;Examples and instructions&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 14:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895903#M353968</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-26T14:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming from monthly to weekly variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895904#M353969</link>
      <description>&lt;P&gt;Before you do anything else, transform your stupid wide data to intelligent long data, converting the interesting part of the names to SAS date values on the way. Data (dates) does not belong in structure (variable names)!&lt;/P&gt;
&lt;P&gt;From there, you can create weekly data rather easily, but first you need to clearly define what a "week" is in your context, e.g starts on Sunday, starts on Monday, or starts on a given day (e.g. the first of a month) using a 7-day interval from there. If a week starts on a fixed weekday, how do you allocate partial weeks to months?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 14:09:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transforming-from-monthly-to-weekly-variables/m-p/895904#M353969</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-26T14:09:00Z</dc:date>
    </item>
  </channel>
</rss>

