<?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: Finding the date that correspond to the lowest value (unordered) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346969#M273244</link>
    <description>&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;vname&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;idx&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'_date'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will get string "var1_date" (var1 has the min value).&lt;/P&gt;
&lt;P&gt;vvaluex("var1_date") means get the value of variable var1_date.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2017 09:51:33 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-04-04T09:51:33Z</dc:date>
    <item>
      <title>Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346787#M273225</link>
      <description>&lt;P&gt;Hi guys! I have a new question.&lt;/P&gt;&lt;P&gt;I have a dataset that looks like (observation=108):&lt;/P&gt;&lt;P&gt;var1 &amp;nbsp; var1_date &amp;nbsp; num2&amp;nbsp; &amp;nbsp;num2_date &amp;nbsp; &amp;nbsp;cd4_3 &amp;nbsp; &amp;nbsp; cd4_3date &amp;nbsp; &amp;nbsp;var4 &amp;nbsp; &amp;nbsp; date4 &amp;nbsp; &amp;nbsp; &amp;nbsp;....... &amp;nbsp; var16 &amp;nbsp; &amp;nbsp;date16&lt;/P&gt;&lt;P&gt;200 &amp;nbsp; &amp;nbsp;08/09/16 &amp;nbsp; &amp;nbsp; 300 &amp;nbsp; &amp;nbsp; &amp;nbsp;05/02/16 &amp;nbsp; &amp;nbsp; &amp;nbsp; 400 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;06/10/15 &amp;nbsp; &amp;nbsp; &amp;nbsp; 500 &amp;nbsp; &amp;nbsp;01/20/15 &amp;nbsp; ....... &amp;nbsp; &amp;nbsp;350 &amp;nbsp; &amp;nbsp; 02/15/05&lt;/P&gt;&lt;P&gt;250 &amp;nbsp; &amp;nbsp;07/06/16 &amp;nbsp; &amp;nbsp; 200 &amp;nbsp; &amp;nbsp; &amp;nbsp;04/10/14&lt;/P&gt;&lt;P&gt;100 &amp;nbsp; &amp;nbsp;01/02/17 &amp;nbsp; &amp;nbsp; 150 &amp;nbsp; &amp;nbsp; &amp;nbsp;06/01/15 &amp;nbsp; &amp;nbsp; &amp;nbsp; 550 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;02/10/15 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;I used the min function to find the lowest numerical value for each observation. Now, I need to find the date that correspond to minumum numerical value (e.g for obs 1 it would be&amp;nbsp;&lt;SPAN&gt;08/09/16, obs 2 would be&amp;nbsp;04/10/14...). How can I proceed to do that??&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 17:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346787#M273225</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-03T17:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346807#M273226</link>
      <description>&lt;P&gt;If at any point earlier in your code you can keep the variables named with numeric suffixes, this will make the problem much easier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var1 vardate1 var2 vardate2, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any chance you can easily make that happen?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, can there be ties in there and how would you want to treat them? That is, what if the min appears twice but the date value is different?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346807#M273226</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-03T19:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346812#M273227</link>
      <description>&lt;P&gt;The solution offered here for max will work for min as well, change the function to MIN instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/SAS-programming-select-a-numerical-value-with-the-oldest/m-p/346554#M44686" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/SAS-programming-select-a-numerical-value-with-the-oldest/m-p/346554#M44686&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array vars(*) var1-var16;
array dates(*) date1-date16;

index_largest = whichn(max(of dates(*)), of dates(*)); 
value = vars(index_largest);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346812#M273227</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-03T19:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346814#M273228</link>
      <description>&lt;P&gt;Yes I can create new variables and just make them equal to the values in the original variables.&lt;/P&gt;&lt;P&gt;For ties, I would want to count both the date values if they are different. Is that possible?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346814#M273228</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-03T19:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346815#M273229</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/135827"&gt;@michan22&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes I can create new variables and just make them equal to the values in the original variables.&lt;/P&gt;
&lt;P&gt;For ties, I would want to count both the date values if they are different. Is that possible?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Count? How would that look? Please post sample data and output that reflects your situation.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346815#M273229</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-03T19:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346816#M273230</link>
      <description>&lt;P&gt;Any thought on ties? This will return the first, if I'm reading the documentation correctly.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346816#M273230</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-03T19:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346817#M273231</link>
      <description>&lt;P&gt;And how many ties could occur? Could you have the same value for the var with different dates in every case?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My thought was a new array to ouput the dates that match, but realistically how many possible ties would you need to account for?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346817#M273231</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-03T19:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346824#M273232</link>
      <description>&lt;P&gt;Here's one possibility on how to deal with ties. It assumes that you could have a constant value for your "var" array, so all would be ties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
    format date1 - date5 date9.;
    informat date1 - date5 date9.;
    input var1 - var5 date1 - date5;
datalines;
1 3 0 4 5 01JAN2017 02JAN2017 03JAN2017 04JAN2017 05JAN2017
1 3 0 0 5 01JAN2017 02JAN2017 03JAN2017 04JAN2017 05JAN2017
0 3 0 4 5 01JAN2017 02JAN2017 03JAN2017 04JAN2017 05JAN2017
;

data want;
    set have;
    array var{*} var:;
    array date{*} date:;

    /* With no ties, this is an ideal solution. */
    reeza = date(whichn(min(of var(*)), of var(*)));

    array match{5} match1 - match5;
    do i = 1 to 5;
        if var(i) = min(of var(*)) then match(i) = date(i);
    end;

    /* This sorts the matches ascending, so . comes first. */
    call sortn(of match{*});
    /* This reverses the sort, so you end up with desceding sort. */
    array rev{*} match5 - match1;
    call sortn(of rev{*});

    format reeza match1 - match5 date9.;

    /* Drop extraneous variables as as necessary... */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Apr 2017 19:56:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346824#M273232</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-03T19:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346827#M273233</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93752"&gt;@collinelliot&lt;/a&gt;&amp;nbsp;A variable named reeza? I'm flattered&amp;nbsp;&lt;img id="cathappy" class="emoticon emoticon-cathappy" src="https://communities.sas.com/i/smilies/16x16_cat-happy.png" alt="Cat Happy" title="Cat Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 20:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346827#M273233</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-03T20:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346830#M273234</link>
      <description>&lt;P&gt;Credit where credit is due!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 20:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346830#M273234</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-03T20:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346850#M273235</link>
      <description>&lt;P&gt;Also, see&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;'s solution for the reordering of columns in this post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Ordering-Dates-Horizontal-Data/m-p/346838#M63589" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Ordering-Dates-Horizontal-Data/m-p/346838#M63589&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 21:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346850#M273235</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-04-03T21:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346855#M273236</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/93752"&gt;@collinelliot&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Here a combination of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'a and your code which also identifies ties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data smallest ties;
    row_id=_n_;

    format date1 - date5 date9.;
    informat date1 - date5 date9.;
    input var1 - var5 date1 - date5;

    array vars{*} var:;
    array dates{*} date:;

    /* first lowest value */
    index_smallest = whichn(min(of vars(*)), of vars(*)); 
    format date date9.;
    date = dates(index_smallest);
    value = vars(index_smallest);
    output;

    /* ties? */
    do _i=index_smallest+1 to dim(vars);
      if value=vars(_i) then 
        do;
          date = dates(_i);
          output ties;
        end;    
    end;

    drop _i;
datalines;
4 3 0 1 5 01JAN2017 02JAN2017 03JAN2017 04JAN2017 05JAN2017
1 3 0 0 5 01JAN2017 02JAN2017 03JAN2017 04JAN2017 05JAN2017
3 0 0 4 5 01JAN2017 02JAN2017 03JAN2017 04JAN2017 05JAN2017
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 22:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346855#M273236</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-04-03T22:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346864#M273237</link>
      <description>&lt;P&gt;Sorry, I meant that I would want the new variable to return the date (that correspond to the lowest numerical value) for each observation, even if there are multiple observations with the same lowest numerical value. I don't expect there to be a lot of ties, but there will be a few observations with the same (lowest) numerical values.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2017 23:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346864#M273237</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-03T23:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346902#M273238</link>
      <description>&lt;P&gt;Thank you for the advice!&lt;/P&gt;&lt;P&gt;I am relatively new to SAS and can you explain what this line does?&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt; reeza &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;whichn&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;min&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;of &lt;SPAN class="token keyword"&gt;var&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; of &lt;SPAN class="token keyword"&gt;var&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In order to find the date with the lowest value, I have to first tell SAS that var1 is linked to date1 and var2 linked to date2 and so on right? is that what the array match does?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 02:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346902#M273238</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-04T02:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346910#M273239</link>
      <description>&lt;P&gt;That's not correct.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You tell SAS var1 is linked to date1 by having a consistent index. The array definitions ensure that the variables line up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rest is functions that are nested.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Min/max -&amp;gt; find the minimum or maximum value, excluding missing values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;WHICHN -&amp;gt; &amp;nbsp;searches through an array for a specified value, and returns the first index of where it's found.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of var(*) -&amp;gt; short cut notation to reference an array.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date() -&amp;gt; returns the value from the date array at specified value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now combine that all to solve your problem. You may want to break it out step by step.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 03:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346910#M273239</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-04T03:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346915#M273240</link>
      <description>&lt;P&gt;use VVALUEX() funtion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var1   var1_date : mmddyy10.  num2   num2_date : mmddyy10.    cd4_3     cd4_3date  : mmddyy10.;
format var1_date num2_date   cd4_3date  mmddyy10.;
cards;
200    08/09/16     300      05/02/16       400        06/10/15       500    01/20/15   .......    350     02/15/05
250    07/06/16     200      04/10/14 . .
100    01/02/17     150      06/01/15       550        02/10/15   
;
run;
data want;
 set have;
 array x{*} var1 num2 cd4_3;
 idx=whichn(min(of x{*}),of x{*});
 min_date=vvaluex(cats(vname(x{idx}),'_date'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Apr 2017 03:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346915#M273240</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-04T03:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346929#M273241</link>
      <description>&lt;P&gt;When I ran the array codes the log says&lt;/P&gt;&lt;P&gt;ERROR: array subscript out of range at line 865 column 4.&lt;/P&gt;&lt;P&gt;Are some of my variables not in the right format?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 05:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346929#M273241</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-04T05:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346930#M273242</link>
      <description>&lt;P&gt;Thanks for the advice!&lt;/P&gt;&lt;P&gt;I created new variables for both the numerical and date variables so that they are in order (newcd4_1-newcd4_17 and newcd4date_1-newcd4date_17).&lt;/P&gt;&lt;P&gt;I put:&lt;/P&gt;&lt;P&gt;array x{*} newcd4_1-newcd4_17;&lt;/P&gt;&lt;P&gt;idx=whichn(min(of x{*}),of x{*});&lt;/P&gt;&lt;P&gt;min_date=vvaluex(cats(vname(x{idx}),'_date'));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;log says&amp;nbsp;&lt;/P&gt;&lt;P&gt;argument to function VVALUEX is not a known variable name: newcd4_17_date.&lt;/P&gt;&lt;P&gt;I think it's _date not matching the new variables I created?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 05:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346930#M273242</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-04T05:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346935#M273243</link>
      <description>&lt;P&gt;I changed the date variable names to .... _date and it worked!&lt;/P&gt;&lt;P&gt;Can you tell me what vvaluex function does and what does this line do exactly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;min_date&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;vvaluex&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;vname&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;idx&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'_date'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thank you so much!!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 06:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346935#M273243</guid>
      <dc:creator>michan22</dc:creator>
      <dc:date>2017-04-04T06:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the date that correspond to the lowest value (unordered)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346969#M273244</link>
      <description>&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;vname&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;x&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;idx&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'_date'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will get string "var1_date" (var1 has the min value).&lt;/P&gt;
&lt;P&gt;vvaluex("var1_date") means get the value of variable var1_date.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 09:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-date-that-correspond-to-the-lowest-value-unordered/m-p/346969#M273244</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-04T09:51:33Z</dc:date>
    </item>
  </channel>
</rss>

