<?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: exclude a varaible from an array? how to do it? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105867#M258504</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thnak you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Feb 2013 16:26:45 GMT</pubDate>
    <dc:creator>Lulus</dc:creator>
    <dc:date>2013-02-12T16:26:45Z</dc:date>
    <item>
      <title>exclude a varaible from an array? how to do it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105865#M258502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I have this question.&amp;nbsp; &lt;BR /&gt;I need to do a repetitive steps, I have 5 kind of fruit f1-f5 indicating the amount of suger in it and&lt;/P&gt;&lt;P&gt;if f1&amp;gt;max(f2,f3,f4,f5) then label=one;&lt;BR /&gt;else if f2&amp;gt;max(f1,f3,f4,f5) then label=two;&lt;BR /&gt;else if f3&amp;gt;max(f1,f2,f4,f5) then label=three;&lt;BR /&gt;else if f4&amp;gt;max(f2,f3,f4,f5) then label=four;&lt;BR /&gt;else if f5&amp;gt;max(f1,f2,f3,f4) then label=five;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if (f1+f2)&amp;lt;=10 and max(f3,f4,f5)&amp;lt;20 then label=type2one; &lt;BR /&gt;else if (f1+f3)&amp;lt;=10 and max(f2,f3,f4)&amp;lt;20 then label=type2one; &lt;BR /&gt;else if (f1+f4)&amp;lt;=10 and max(f2,f3,f4)&amp;lt;20 then label=type2two; &lt;BR /&gt;else if (f1+f5)&amp;lt;=10 and max(f2,f3,f4)&amp;lt;20 then label=type2three; &lt;/P&gt;&lt;P&gt;else if (f2+f3)&amp;lt;=10 and max(f3,f4,f5)&amp;lt;20 then label=type2four; &lt;BR /&gt;else if (f2+f4)&amp;lt;=10 and max(f3,f4,f5)&amp;lt;20 then label=type2five; &lt;/P&gt;&lt;P&gt;..................and on and on;&lt;/P&gt;&lt;P&gt;but basically there is a rule that for "single fruit" case,you just exclude the one used up frount and &lt;BR /&gt;for for the "two fruit" case, you exlcude whatever two mentitoned first,&lt;/P&gt;&lt;P&gt;So I hope to do something like, &lt;/P&gt;&lt;P&gt;array fruit1 {*} f1 f2 f3 f4 f5&lt;BR /&gt;array fruit2 {*} f1 f2 f3 f4 f5&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;do i=1 to 5;&lt;BR /&gt; if fruit(i)&amp;gt;max(fruit but fruit(i))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fruit(i))+fruit(i+1))&amp;lt;=10 and max(fruit but (fruit(i) ,fruit(i+1))) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;lt;- here I have another problem though, i is supposed from 1 to 5 but here it will be ended with 6 not really that I want; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Please let me know how do you do it.&amp;nbsp; Appreiciate your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 22:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105865#M258502</guid>
      <dc:creator>Lulus</dc:creator>
      <dc:date>2013-02-11T22:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: exclude a varaible from an array? how to do it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105866#M258503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lulus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure that your logic will handle a tie for the top spot, or that you are assigning the proper values to LABEL, but here are some ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To handle one variable you could simplify things in this fashion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;max_value = max(of f1-f5);&lt;/P&gt;&lt;P&gt;do _i_=1 to 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if fruit1{_i_} = max_value then label=put(_i_, 1.);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Handling two variables is harder.&amp;nbsp; Here's one way to approach the problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do _i_=1 to 4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do _j_ = _i_+1 to 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_value = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _k_=1 to 5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_k_ ne _i_) and (_k_ ne _j_) then max_value = max(max_value, fruit1{_k_};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fruit1{_i_} + fruit1{_j_} &amp;lt;= 10 and max_value &amp;lt; 20 then label = put(_i_,1.) || ' ' || put(_j_, 1.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It doesn't do exactly what you started to explain, but it's difficult to tell what result you wanted to obtain for LABEL.&amp;nbsp; At any rate, this gives you a way to identify the cases you were looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 03:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105866#M258503</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-02-12T03:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: exclude a varaible from an array? how to do it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105867#M258504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thnak you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 16:26:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/exclude-a-varaible-from-an-array-how-to-do-it/m-p/105867#M258504</guid>
      <dc:creator>Lulus</dc:creator>
      <dc:date>2013-02-12T16:26:45Z</dc:date>
    </item>
  </channel>
</rss>

