<?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: return conditional max value across columns in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269689#M7485</link>
    <description>&lt;P&gt;This is why I ask for test data and required output. &amp;nbsp;I can't see any logical reason why 20 would be the maximum value from that set of variables:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;a=1, b=10, c=98, d=99, e=99, f=98, g=20, h=.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you mean anything 90 or above is missing? &amp;nbsp;Then maybe:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data want;
  a=1; b=10; c=98; d=99; e=98; f=98; g=20; h=.;
  array rep{7} a b c d e f g h;
  array act{7};
  do i=1 to 7;
    act=ifn(rep{i}&amp;gt;90,.,rep{i});
  end;
  new_var=max(of act);
run; &lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I don't have access to SAS at the moment to test the code, but something like that should work.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2016 10:16:08 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-05-11T10:16:08Z</dc:date>
    <item>
      <title>return conditional max value across columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269679#M7482</link>
      <description>&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;Hi there.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;Can I please ask how can I&amp;nbsp;return a conditional max value across columns?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;Let say I have a=1, b=10, c=98, d=99, e=99, f=98, g=20, h=.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;and I would like another new column i.e. max=20.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman, times" size="4"&gt;&lt;SPAN style="line-height: normal;"&gt;Thank you very much.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 09:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269679#M7482</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2016-05-11T09:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: return conditional max value across columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269686#M7483</link>
      <description>&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;new_variable=max(a,b,c,d,e,f,g,h);&lt;/PRE&gt;
&lt;P&gt;For better code, please post test data in the form of a datastep covering all permutations, and what the output should look like.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 10:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269686#M7483</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-11T10:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: return conditional max value across columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269687#M7484</link>
      <description>&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;&lt;SPAN&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9﻿&lt;/a&gt;&amp;nbsp;thank you very much for the quick reply.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;&lt;SPAN&gt;new_variable=99 if I use n&lt;/SPAN&gt;&lt;SPAN&gt;ew_variable=max(a,b,c,d,e,f,g,h) when numeric variables of&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;a=1, b=10, c=98, d=99, e=99, f=98, g=20, h=.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;&lt;SPAN&gt;But I need 20 to be returned given this particular case only in a datastep.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="4"&gt;Thank you very much.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 10:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269687#M7484</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2016-05-11T10:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: return conditional max value across columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269689#M7485</link>
      <description>&lt;P&gt;This is why I ask for test data and required output. &amp;nbsp;I can't see any logical reason why 20 would be the maximum value from that set of variables:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;a=1, b=10, c=98, d=99, e=99, f=98, g=20, h=.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you mean anything 90 or above is missing? &amp;nbsp;Then maybe:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data want;
  a=1; b=10; c=98; d=99; e=98; f=98; g=20; h=.;
  array rep{7} a b c d e f g h;
  array act{7};
  do i=1 to 7;
    act=ifn(rep{i}&amp;gt;90,.,rep{i});
  end;
  new_var=max(of act);
run; &lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I don't have access to SAS at the moment to test the code, but something like that should work.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 10:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/269689#M7485</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-05-11T10:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: return conditional max value across columns</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/270618#M7495</link>
      <description>&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9﻿&lt;/a&gt;.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;Sorry for the late reply and failing to make the question clearer in the first place.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;Just ran your code and with a little change I managed to get it worked.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="times new roman,times" size="3"&gt;Again thank you very much.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	a=1; b=10; c=98; d=99; e=98; f=98; g=20; h=.;
	array rep{8} a b c d e f g h;
	array act{8};
	do i=1 to 8;
	act{i}=ifn(rep{i}&amp;gt;90,.,rep{i});
	end;
	new_var=max(of act[*]);
	drop i act:;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2016 01:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/return-conditional-max-value-across-columns/m-p/270618#M7495</guid>
      <dc:creator>Miracle</dc:creator>
      <dc:date>2016-05-16T01:11:36Z</dc:date>
    </item>
  </channel>
</rss>

