<?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: Output of min from proc means in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614476#M18602</link>
    <description>&lt;P&gt;You could answer directly the question from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; in which he said:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Ah jeez, are you asking row min or column min? Can you please clarify?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many of us will not download Microsoft Office files as they can be security risks; so we cannot see the data you posted. The preferred method to post data for a SAS problem is: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Dec 2019 22:07:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-12-30T22:07:34Z</dc:date>
    <item>
      <title>Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614457#M18593</link>
      <description>&lt;P&gt;Using SAS 9.4&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data = volume3 min;&lt;BR /&gt;var pre_total_SL_count pre_Total_CL_count postop_total_sl_count_2wks postop_total_cl_count_2wks postop_total_sl_count_6wks postop_total_cl_count_6wks;&lt;BR /&gt;class study_id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 6 variables and I used a proc means to get the minimum of each variable. One example has a minimum of 12 12 12 12 11 11 (corresponding to the 6 variable above in the 'var' line).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following code to try and output the minimum of the minimum by a group id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data = volume3 noprint nway min;&lt;BR /&gt;var pre_total_SL_count pre_Total_CL_count postop_total_sl_count_2wks postop_total_cl_count_2wks postop_total_sl_count_6wks postop_total_cl_count_6wks;&lt;BR /&gt;class study_id;&lt;BR /&gt;output out= count_min min = x_min;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the code I used only return the minimum of the first variable (12 from the example above and I would need it to return the 11 as that is the smallest. The smallest will not always be in the last position, it could be in any of the 6 locations).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to output the minimum across all 6 variables? Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614457#M18593</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-12-30T21:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614459#M18594</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp; If you are lazy like me, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; output out=want min=/autoname;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614459#M18594</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-30T21:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614464#M18595</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;That keeps all of the information in its own column but is there a way to pull out the smallest number that is not zero?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:44:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614464#M18595</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-12-30T21:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614467#M18596</link>
      <description>&lt;P&gt;Ah jeez, are you asking row min or column min? Can you please clarify?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Better if you could a clear sample of what you HAVE and WANT&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:47:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614467#M18596</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-30T21:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614470#M18597</link>
      <description>&lt;P&gt;Nothing lazy about it. That's why SAS added the autoname= option, as a method to reduce typing.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614470#M18597</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-30T21:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614471#M18598</link>
      <description>&lt;P&gt;I have the data classed by an ID. So I have 6 different minimums (1 for each variable) per ID and I want to pull out just the smallest non-zero minimum. Is there a good method to do that? I attached an image of what I have. The code I attached produces only the minimum of the first variable. I want the minimum of the each group as long as it is not zero.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614471#M18598</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-12-30T21:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614472#M18599</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;That keeps all of the information in its own column but is there a way to pull out the smallest number that is not zero?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please give an example or clarification. The smallest number that is not zero could be -999 which could be smaller than all the positive numbers and is certainly not zero.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614472#M18599</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-30T21:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614473#M18600</link>
      <description>&lt;P&gt;The data I have is 0 to 20 so I need the smallest non-zero across the 6 variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 21:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614473#M18600</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-12-30T21:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614475#M18601</link>
      <description>&lt;P&gt;For this particular question you either 1) post process the data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data=sashelp.stocks noprint nway ;
   class stock;
   var open high low close adjclose;
   output out=work.summary min=;
run;

data work.mins;
   set work.summary;
   minval = min(open, high, low, close, adjclose);
run;&lt;/PRE&gt;
&lt;P&gt;2) transpose your data so the values hidden in the variable names are actual values. then summarize the Value without the time information. Your variable names apparently contain at least two pieces of information, whatever SL and SL refer to and a time point: Pre, 2wks and 6wks. Each of those for most modeling and reporting processes would work much better as additional variables. Then your response would be&lt;/P&gt;
&lt;P&gt;Proc means data=transposed min;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var count;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class study_id;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then if you ever wanted to know something about the SL/CL or time frame only use the appropriate class variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or even get all the likely needed summaries at one time:&lt;/P&gt;
&lt;P&gt;Proc summary data=transposed;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; class study_id SLCL time;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var count;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output out=work.summary&amp;nbsp; min=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the _type_ variable would indicate the min across all the data, within each of study_id, SLCL, or time, and the combinations of study/SLCL, study/Time, SLCL/time and study/SLCL/Time&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 22:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614475#M18601</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-30T22:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614476#M18602</link>
      <description>&lt;P&gt;You could answer directly the question from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt; in which he said:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Ah jeez, are you asking row min or column min? Can you please clarify?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many of us will not download Microsoft Office files as they can be security risks; so we cannot see the data you posted. The preferred method to post data for a SAS problem is: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 22:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614476#M18602</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-30T22:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614477#M18603</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp; Please post a clear sample. Okay let me do that for you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have something like this?&lt;/P&gt;
&lt;TABLE width="384"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Var1&lt;/TD&gt;
&lt;TD width="64"&gt;var2&amp;nbsp;&lt;/TD&gt;
&lt;TD width="64"&gt;var3&lt;/TD&gt;
&lt;TD width="64"&gt;var4&lt;/TD&gt;
&lt;TD width="64"&gt;var5&lt;/TD&gt;
&lt;TD width="64"&gt;var6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the first row min=1&lt;/P&gt;
&lt;P&gt;and 2nd row min=1 i.e here you don't consider 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am i right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Sir agreed, AUTONAME is a beautiful option &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 22:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614477#M18603</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-30T22:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614479#M18604</link>
      <description>&lt;P&gt;Yes you are correct.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 22:09:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614479#M18604</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2019-12-30T22:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614482#M18605</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/194348"&gt;@GS2&lt;/a&gt;&amp;nbsp; Okay the logic is simple, Let us know if you can follow the code below. I have created a sample for you and the solution&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*Sample HAVE*/
data have;
 call streaminit(12345);
 array v(20);
 do _iorc_= 1 to 50;
 do _n_=1 to dim(v);
  v(_n_)=int(rand('uniform',0,20));
 end;
 output;
 end;
run;
/*Solution*/
data want;
 set have;
 array t v:;
 do over t;
  if t=0 then call missing(t);
 end;
 want=min(of t(*));
 set have point=_n_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;/*or*/&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Solution*/
data want;
 set have;
 array t v:;
 call sortn(of t(*));
 do over t;
  if t then do;
   min=t; 
   leave;
 end;
 end;
 set have point=_n_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 00:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614482#M18605</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-31T00:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614506#M18608</link>
      <description>&lt;P&gt;I assume you included the extra SET statement to re-read the observation so that any zeros that were converted to missing are reset back to zero.&amp;nbsp; Note that for this problem there was no need to include the POINT= option on the second SET statement.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 02:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614506#M18608</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-31T02:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Output of min from proc means</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614507#M18609</link>
      <description>&lt;P&gt;Thank you sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; Oops how silly i was. Cheers for correcting me and can't appreciate enough. I mean it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 02:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-of-min-from-proc-means/m-p/614507#M18609</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-31T02:56:04Z</dc:date>
    </item>
  </channel>
</rss>

