<?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: replace lowest value in a list of numbers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704445#M215949</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13712"&gt;@GreggB&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input test1-test4 final;
cards;
88 90 100 50 75
90 55 70 100 50
;

data want;
set have;
array g[*] test1--final;
g[whichn(min(of g[*]), of g[*])]=final;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 08 Dec 2020 16:47:59 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2020-12-08T16:47:59Z</dc:date>
    <item>
      <title>replace lowest value in a list of numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704437#M215947</link>
      <description>&lt;P&gt;Students take 4 tests and a final exam. I replace the lowest test grade with the final exam grade. If the final exam is the lowest grade, nothing happens. If there is a tie between the 2 lowest grades, I don't care which one involved in the tie gets replaced.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;data before applying the substitution&lt;/P&gt;
&lt;P&gt;test1 test2 test3 test4 final&lt;/P&gt;
&lt;P&gt;88&amp;nbsp; &amp;nbsp; &amp;nbsp; 90&amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; 50&amp;nbsp; &amp;nbsp; &amp;nbsp; 75&lt;/P&gt;
&lt;P&gt;90&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;55&amp;nbsp; &amp;nbsp; &amp;nbsp; 70&amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; 50&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data after applying the substitution&lt;/P&gt;
&lt;P&gt;test1 test2 test3 test4 final&lt;/P&gt;
&lt;P&gt;88&amp;nbsp; &amp;nbsp; &amp;nbsp; 90&amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;75&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 75&lt;/P&gt;
&lt;P&gt;90&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;55&amp;nbsp; &amp;nbsp; &amp;nbsp; 70&amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; 50&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 16:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704437#M215947</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2020-12-08T16:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: replace lowest value in a list of numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704445#M215949</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13712"&gt;@GreggB&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input test1-test4 final;
cards;
88 90 100 50 75
90 55 70 100 50
;

data want;
set have;
array g[*] test1--final;
g[whichn(min(of g[*]), of g[*])]=final;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Dec 2020 16:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704445#M215949</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-12-08T16:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: replace lowest value in a list of numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704717#M216070</link>
      <description>What if there are two 50 in the first obs?&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input test1-test4 final;&lt;BR /&gt;cards;&lt;BR /&gt;88 90 100 50 75&lt;BR /&gt;90 55 70 100 50&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;array g{*} test1--test4;&lt;BR /&gt;do i=1 to dim(g);&lt;BR /&gt;  g{i}=max(g{i},final) ;&lt;BR /&gt;end;&lt;BR /&gt;drop i;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 09 Dec 2020 14:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704717#M216070</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-12-09T14:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: replace lowest value in a list of numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704723#M216073</link>
      <description>&lt;P&gt;what if there are two 50 in the first obs ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
input test1-test4 final;
cards;
88 90 100 50 75
90 55 70 100 50
;

data want;
set have;
array g{*} test1--test4;
do i=1 to dim(g);
  g{i}=max(g{i},final) ;
end;
drop i;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Dec 2020 14:07:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704723#M216073</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-12-09T14:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: replace lowest value in a list of numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704732#M216075</link>
      <description>&lt;P&gt;I would want to replace one of them. It wouldn't matter which one.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 14:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/replace-lowest-value-in-a-list-of-numbers/m-p/704732#M216075</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2020-12-09T14:27:57Z</dc:date>
    </item>
  </channel>
</rss>

