<?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: any simple way to find which one is min in a large set of variables? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24209#M5461</link>
    <description>Hi:&lt;BR /&gt;
  &lt;BR /&gt;
Consider this fake data:&lt;BR /&gt;
[pre]&lt;BR /&gt;
grp  var_1  var_2  var_3&lt;BR /&gt;
aaa    1      2      3&lt;BR /&gt;
bbb    .      3      4&lt;BR /&gt;
ccc    1      0      .&lt;BR /&gt;
ddd    0      0      0&lt;BR /&gt;
[/pre]&lt;BR /&gt;
          &lt;BR /&gt;
would you need to find the MIN of all the VAR_1 values, all the VAR_2 values, all the VAR_3 values?? Or, would you need to find the MIN on the row for grp=aaa and then the MIN for grp=bbb, etc? Or, do you need to find out the minimum value for ALL the variables across the entire dataset?&lt;BR /&gt;
 &lt;BR /&gt;
Also, should the missing (.) be treated differently from the zero (0) values??&lt;BR /&gt;
 &lt;BR /&gt;
You can probably do quite a bit with PROC MEANS if you are looking for the MIN value across the whole dataset or based on classification variables (like GRP). You might have to use the MIN function in a DATA step program if you wanted to find the MIN for an entire row or observation.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
    <pubDate>Wed, 27 Oct 2010 22:19:06 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2010-10-27T22:19:06Z</dc:date>
    <item>
      <title>any simple way to find which one is min in a large set of variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24208#M5460</link>
      <description>I have var_1 to var_n, some are missing, now I need to find the smallest value. Once I know the min, then I need to find which variable achieves the min. I can write a loop to solve the problem. However, is there any function that can do the job in a simple way?</description>
      <pubDate>Wed, 27 Oct 2010 21:23:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24208#M5460</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-27T21:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: any simple way to find which one is min in a large set of variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24209#M5461</link>
      <description>Hi:&lt;BR /&gt;
  &lt;BR /&gt;
Consider this fake data:&lt;BR /&gt;
[pre]&lt;BR /&gt;
grp  var_1  var_2  var_3&lt;BR /&gt;
aaa    1      2      3&lt;BR /&gt;
bbb    .      3      4&lt;BR /&gt;
ccc    1      0      .&lt;BR /&gt;
ddd    0      0      0&lt;BR /&gt;
[/pre]&lt;BR /&gt;
          &lt;BR /&gt;
would you need to find the MIN of all the VAR_1 values, all the VAR_2 values, all the VAR_3 values?? Or, would you need to find the MIN on the row for grp=aaa and then the MIN for grp=bbb, etc? Or, do you need to find out the minimum value for ALL the variables across the entire dataset?&lt;BR /&gt;
 &lt;BR /&gt;
Also, should the missing (.) be treated differently from the zero (0) values??&lt;BR /&gt;
 &lt;BR /&gt;
You can probably do quite a bit with PROC MEANS if you are looking for the MIN value across the whole dataset or based on classification variables (like GRP). You might have to use the MIN function in a DATA step program if you wanted to find the MIN for an entire row or observation.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Wed, 27 Oct 2010 22:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24209#M5461</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-27T22:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: any simple way to find which one is min in a large set of variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24210#M5462</link>
      <description>cynthia ,&lt;BR /&gt;
I am trying to find the min for each subject in grp. If one of var is missing, then I will not count, for example, min(aaa)=1, min(bbb=3). Also, given min(aaa)=1, then the function can tell me that it is corresponding  to var_1. In R, this is very simple. I want to know if there is any function is SAS can make it easier to code.&lt;BR /&gt;
&lt;BR /&gt;
Jenny</description>
      <pubDate>Thu, 28 Oct 2010 12:44:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24210#M5462</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-10-28T12:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: any simple way to find which one is min in a large set of variables?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24211#M5463</link>
      <description>[pre]&lt;BR /&gt;
120  data _null_;&lt;BR /&gt;
121     array v[3];&lt;BR /&gt;
122     input grp:$3. v&lt;LI&gt;;&lt;BR /&gt;
123     min = min(of v&lt;/LI&gt;&lt;LI&gt;);&lt;BR /&gt;
124     j = whichN(min,of v&lt;/LI&gt;&lt;LI&gt;);&lt;BR /&gt;
125     Name = vname(v&lt;J&gt;);&lt;BR /&gt;
126     put (_all_)(=);&lt;BR /&gt;
127     cards;&lt;BR /&gt;
&lt;BR /&gt;
v1=1 v2=2 v3=3 grp=aaa min=1 j=1 Name=v1&lt;BR /&gt;
v1=. v2=3 v3=4 grp=bbb min=3 j=2 Name=v2&lt;BR /&gt;
v1=1 v2=0 v3=. grp=ccc min=0 j=2 Name=v2&lt;BR /&gt;
v1=0 v2=0 v3=0 grp=ddd min=0 j=1 Name=v1&lt;BR /&gt;
[/pre]&lt;/J&gt;&lt;/LI&gt;</description>
      <pubDate>Thu, 28 Oct 2010 12:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/any-simple-way-to-find-which-one-is-min-in-a-large-set-of/m-p/24211#M5463</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-10-28T12:55:26Z</dc:date>
    </item>
  </channel>
</rss>

