<?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: Deleting 2 lowest values from a row of observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611759#M178372</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* UNTESTED CODE */
data want;
    set have;
    call sortn(of h1-h9);
    average = mean(of h3-h9);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALL SORTN sorts H1-H9 in ascending order, thus H3-H9 are now the 7 largest (doesn't contain the two lowest) and you can average those.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what this will do if there are missing values in H1 through H9.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2019 22:59:58 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-12-13T22:59:58Z</dc:date>
    <item>
      <title>Deleting 2 lowest values from a row of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611756#M178369</link>
      <description>&lt;P&gt;Hello! I have a data set that looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID H1 H2 H3 H4 H5 H6 H7 H8 H9&lt;/P&gt;
&lt;P&gt;01 10 10 10 10 10 10 10 10 10&lt;/P&gt;
&lt;P&gt;02 10 8 5 10 10 0 9 10 3&lt;/P&gt;
&lt;P&gt;03 9 10 8 10 9 10 10 10 6&lt;/P&gt;
&lt;P&gt;04 7 10 7 8 10 0 10 0 10&lt;/P&gt;
&lt;P&gt;05 5 10 6 10 4 10 10 9 10&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to drop the lowest 2 homework scores and create a variable for the overall homework score for a student. So say for student ID 04, the two zero grades would be dropped and a percentage for homework would be (7+10+7+8+10+10+10)/70 = 88.6 % (homework scores are out of 10.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ive tried commands like this in the data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;oops1= min(of Q1--Q9);
if H1=min(of Q1--Q9) then drop H1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I'm not sure where to go from here. Based on my research I think I might need to build an array? Hopefully not cause I have very little experience with that. Any advice would be greatly appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 22:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611756#M178369</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-12-13T22:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting 2 lowest values from a row of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611759#M178372</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* UNTESTED CODE */
data want;
    set have;
    call sortn(of h1-h9);
    average = mean(of h3-h9);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CALL SORTN sorts H1-H9 in ascending order, thus H3-H9 are now the 7 largest (doesn't contain the two lowest) and you can average those.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what this will do if there are missing values in H1 through H9.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 22:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611759#M178372</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-13T22:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting 2 lowest values from a row of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611767#M178378</link>
      <description>&lt;P&gt;On of my lines is:&lt;BR /&gt;5 9 0 0 0 0 0 0 0&lt;BR /&gt;&lt;STRIKE&gt;for HW 1-9. If the code worked as it should, I should get 2 as the output for average right? (5+9+0+0+0+0+0)/7=2. Instead I got 1.3571. Is my math wrong or is the code wrong?&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NEVERMIND! I just had to change some variable names. ALL GOOD THANK YOU!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 23:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-2-lowest-values-from-a-row-of-observations/m-p/611767#M178378</guid>
      <dc:creator>valarievil</dc:creator>
      <dc:date>2019-12-13T23:56:35Z</dc:date>
    </item>
  </channel>
</rss>

