<?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: Copying greatest value row to all other rows within a 4 week interval (4 rows) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867076#M342433</link>
    <description>Thanks, that worked!</description>
    <pubDate>Wed, 29 Mar 2023 17:24:56 GMT</pubDate>
    <dc:creator>edison83</dc:creator>
    <dc:date>2023-03-29T17:24:56Z</dc:date>
    <item>
      <title>Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867046#M342420</link>
      <description>&lt;P&gt;Hi everyone, I have the following table below, where each row is a weekly event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 336pt;" border="0" width="448" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD colspan="3" width="192" height="20" class="xl63" style="height: 15.0pt; width: 144pt;"&gt;HAVE&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD colspan="3" width="192" class="xl63" style="width: 144pt;"&gt;WANT&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;year&lt;/TD&gt;
&lt;TD class="xl63"&gt;week&lt;/TD&gt;
&lt;TD class="xl63"&gt;Count&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;year&lt;/TD&gt;
&lt;TD class="xl63"&gt;week&lt;/TD&gt;
&lt;TD class="xl63"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;41&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;41&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;42&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;42&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;43&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;43&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;44&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;44&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;45&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;45&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;46&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;46&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;47&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;47&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;48&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;48&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;49&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;49&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;50&lt;/TD&gt;
&lt;TD class="xl63"&gt;35&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;50&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;51&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;51&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;52&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;52&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;12&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;
&lt;P&gt;830&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some weeks contains a smaller value and other weeks are assigned to zero or smaller values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to copy the greatest value between the 4 week interval to all rows within this interval?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let`s say that from week 1-4 select the greatest value will be copied to all other rows in this interval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will continue until the end of the year (until week 52)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867046#M342420</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-03-29T15:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867051#M342421</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;

array p{0:3} _temporary_;
set have; 
by year;

if first.year then 
     call missing(of p{*});

p{mod(_n_,4)} = count;
count_want= max(of p{*});

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/305638"&gt;@edison83&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi everyone, I have the following table below, where each row is a weekly event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 336pt;" border="0" width="448" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD colspan="3" width="192" height="20" class="xl63" style="height: 15.0pt; width: 144pt;"&gt;HAVE&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD colspan="3" width="192" class="xl63" style="width: 144pt;"&gt;WANT&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;year&lt;/TD&gt;
&lt;TD class="xl63"&gt;week&lt;/TD&gt;
&lt;TD class="xl63"&gt;Count&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;year&lt;/TD&gt;
&lt;TD class="xl63"&gt;week&lt;/TD&gt;
&lt;TD class="xl63"&gt;Count&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;41&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;41&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;42&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;42&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;43&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;43&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;44&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;44&lt;/TD&gt;
&lt;TD class="xl63"&gt;872&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;45&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;45&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;46&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;46&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;47&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;47&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;48&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;48&lt;/TD&gt;
&lt;TD class="xl63"&gt;726&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;49&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;49&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;50&lt;/TD&gt;
&lt;TD class="xl63"&gt;35&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;50&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;51&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;51&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;52&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2022&lt;/TD&gt;
&lt;TD class="xl63"&gt;52&lt;/TD&gt;
&lt;TD class="xl63"&gt;762&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;12&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;2&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;1&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;3&lt;/TD&gt;
&lt;TD class="xl63"&gt;830&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl63" style="height: 15.0pt;"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;0&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63"&gt;2023&lt;/TD&gt;
&lt;TD class="xl63"&gt;4&lt;/TD&gt;
&lt;TD class="xl63"&gt;
&lt;P&gt;830&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some weeks contains a smaller value and other weeks are assigned to zero or smaller values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way to copy the greatest value between the 4 week interval to all rows within this interval?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let`s say that from week 1-4 select the greatest value will be copied to all other rows in this interval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will continue until the end of the year (until week 52)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867051#M342421</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-03-29T15:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867053#M342422</link>
      <description>&lt;P&gt;So the intervals are always weeks 1-4, 5-8, 9-12, and so on?&lt;/P&gt;
&lt;P&gt;And do you do this in SAS DI Studio, or in a code node in EG or SAS Studio?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867053#M342422</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-29T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867061#M342423</link>
      <description>&lt;P&gt;Hi Kurt, correct!&lt;/P&gt;
&lt;P&gt;The thing is that in my complete dataset I have 3 years of data, so the loop from week 1-52 repeats three times.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also may be able to replace the weeks by a column with the respective month if that helps.&lt;/P&gt;
&lt;P&gt;For example the week 1-4 of 2023 in my example would all be month=1 ( a single column)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am doing this in SAS studio by the way. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:51:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867061#M342423</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-03-29T15:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867063#M342424</link>
      <description>Hi Kurt, correct!&lt;BR /&gt;&lt;BR /&gt;The thing is that in my complete dataset I have 3 years of data, so the loop from week 1-52 repeats three times.&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;I also may be able to replace the weeks by a column with the respective month if that helps.&lt;BR /&gt;&lt;BR /&gt;For example the week 1-4 of 2023 in my example would all be month=1 ( a single column)&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;I am doing this in SAS studio by the way. Thanks!</description>
      <pubDate>Wed, 29 Mar 2023 16:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867063#M342424</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-03-29T16:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867065#M342425</link>
      <description>&lt;P&gt;&lt;BR /&gt;And another way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, floor((week-1)/4) as week_group, max(count) as max_count
from have 
group by year, week_group;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2023 16:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867065#M342425</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-03-29T16:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867076#M342433</link>
      <description>Thanks, that worked!</description>
      <pubDate>Wed, 29 Mar 2023 17:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867076#M342433</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-03-29T17:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867838#M342758</link>
      <description>&lt;P&gt;Hi Kurt, I saw another post where you wrote a macro for doing something similar to this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know if we could do a macro for the code that our friend mentioned above?&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data want;

array p{0:3} _temporary_;
set have; 
by year;

if first.year then 
     call missing(of p{*});

p{mod(_n_,4)} = count;
count_want= max(of p{*});

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 19:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867838#M342758</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-04-03T19:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867861#M342771</link>
      <description>&lt;P&gt;Which part(s) of the code should be dynamic?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 20:46:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867861#M342771</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-03T20:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867863#M342773</link>
      <description>&lt;P&gt;Sorry for not specifying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to repeat the same code but for 10 more columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so it would be columns: "Count", "Count2", "Count3",... all the way to column "Count10".&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 20:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867863#M342773</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-04-03T20:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867914#M342787</link>
      <description>&lt;P&gt;Transpose by year and week for all count: variables.&lt;/P&gt;
&lt;P&gt;Sort by _name_, year and week.&lt;/P&gt;
&lt;P&gt;Run the same windowing code (by _name_) for variable col1.&lt;/P&gt;
&lt;P&gt;Consider keeping your data in a long layout anyway.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 05:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867914#M342787</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-04T05:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Copying greatest value row to all other rows within a 4 week interval (4 rows)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867998#M342827</link>
      <description>&lt;P&gt;Thanks Kurt, that worked just fine!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 14:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-greatest-value-row-to-all-other-rows-within-a-4-week/m-p/867998#M342827</guid>
      <dc:creator>edison83</dc:creator>
      <dc:date>2023-04-04T14:50:30Z</dc:date>
    </item>
  </channel>
</rss>

