<?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 How to take highest values from different variables and calculate mean in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632190#M187407</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;this time i would like to calculate mean value from different variables (their highest value). Please, suggest a solution.&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;age1&lt;/SPAN&gt; age2 age3 age4 age5 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt; &lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;1 1 3 6 9 2
2 6 2 3 4 4
3 7 2 9 0 0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the mean should be calculated from 9, 6 and 9&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Mar 2020 21:38:43 GMT</pubDate>
    <dc:creator>Skillside</dc:creator>
    <dc:date>2020-03-14T21:38:43Z</dc:date>
    <item>
      <title>How to take highest values from different variables and calculate mean</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632190#M187407</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;this time i would like to calculate mean value from different variables (their highest value). Please, suggest a solution.&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;age1&lt;/SPAN&gt; age2 age3 age4 age5 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt; &lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;1 1 3 6 9 2
2 6 2 3 4 4
3 7 2 9 0 0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the mean should be calculated from 9, 6 and 9&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 21:38:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632190#M187407</guid>
      <dc:creator>Skillside</dc:creator>
      <dc:date>2020-03-14T21:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to take highest values from different variables and calculate mean</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632192#M187409</link>
      <description>&lt;P&gt;Use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;max(of age:)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in a data step to create the max for each observation, then calculate the mean as usual with sql or proc means.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 21:51:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632192#M187409</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-14T21:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to take highest values from different variables and calculate mean</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632197#M187411</link>
      <description>&lt;P&gt;that was too easy &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 22:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632197#M187411</guid>
      <dc:creator>Skillside</dc:creator>
      <dc:date>2020-03-14T22:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to take highest values from different variables and calculate mean</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632200#M187413</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input ID age1 age2 age3 age4 age5 ;
 cards;
1 1 3 6 9 2
2 6 2 3 4 4
3 7 2 9 0 0
;
run;

data mean_of_max_age;
 _n_= 0;
 do until(z);
  set have end=z;
  max_age= max(of age1-age5);
  _n_=sum(_n_,n(max_age));
  _iorc_=sum( _iorc_ ,max_age);
 end;
 Mean= _iorc_/	_n_;
 drop age1-age5 id;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Mar 2020 22:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632200#M187413</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-03-14T22:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to take highest values from different variables and calculate mean</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632528#M187542</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279880"&gt;@Skillside&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;this time i would like to calculate mean value from different variables (their highest value). Please, suggest a solution.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
 &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;age1&lt;/SPAN&gt; age2 age3 age4 age5 &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token datalines"&gt; &lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token data string"&gt;1 1 3 6 9 2
2 6 2 3 4 4
3 7 2 9 0 0&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the mean should be calculated from 9, 6 and 9&lt;/P&gt;
&lt;P&gt;Thank You&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A hint for future example data sets: If you are going to reference the required values it would be a better idea to have those values unique or explicitly state which value from which record. Max is relatively simple but a more complicated question with both 6 and 9 repeated in different records might be another story.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 19:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-take-highest-values-from-different-variables-and/m-p/632528#M187542</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-16T19:53:03Z</dc:date>
    </item>
  </channel>
</rss>

