<?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: min, max, mean, std of values in a single observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351303#M81767</link>
    <description>&lt;P&gt;Try using a double dash (--) not single dash.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Apr 2017 13:52:36 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-04-19T13:52:36Z</dc:date>
    <item>
      <title>min, max, mean, std of values in a single observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351300#M81766</link>
      <description>&lt;P&gt;I have the following data set resp:&lt;/P&gt;&lt;P&gt;PatientID &amp;nbsp;RespRate1 &amp;nbsp;RespRate2 .... &amp;nbsp;RespRate20&lt;/P&gt;&lt;P&gt;XYZ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 17&lt;/P&gt;&lt;P&gt;ACW &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;21 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;17 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 21&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For each row (PatientID) I want to be able to obtain the min, max, mean, and std of the first 10 respiratory rates, then the next ten respiratory rates. I wanted to do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data resp; set resp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;min1 = min(of RespRate1-RespRate10);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;max1 = min(of RespRate1-RespRate10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; mean1 = min(of RespRate1-RespRate10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; std1 = min(of RespRate1-RespRate10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;min2 = min(of RespRate11-RespRate12);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;max2 = min(of RespRate11-RespRate20);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; mean2 = min(of RespRate11-RespRate20);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; std2 = min(of RespRate11-RespRate20);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;Yet the min, max, mean, and std functions don't work unless you list out all of the variables, i.e. min1 = min(RespRate1, RespRate2, RespRate3.... RespRate10).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how to do this in Base SAS (I dont want to go over to IML in this instance).&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351300#M81766</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2017-04-19T13:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: min, max, mean, std of values in a single observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351303#M81767</link>
      <description>&lt;P&gt;Try using a double dash (--) not single dash.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351303#M81767</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-19T13:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: min, max, mean, std of values in a single observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351304#M81768</link>
      <description>&lt;P&gt;There's nothing wrong with the code you are using.&amp;nbsp; Why do you say it doesn't work?&amp;nbsp; The only reason I could think of is if you have some character variables instead of numeric.&amp;nbsp; Of course, you need the numeric values populated ... missing values in the input will generate missing values in the output.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351304#M81768</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-19T13:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: min, max, mean, std of values in a single observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351305#M81769</link>
      <description>&lt;P&gt;Note double dash only works if the variables are side by side. Other option is to declare arrays which you may want to do, if you're doing multiple calculations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note you have a typo in one of your ranges.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array firstTen(*) resprate1-resprate10;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mean1 = mean( of firstTen(*));&lt;/P&gt;
&lt;P&gt;mean2 = mean(of resprate1--resprate10);&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:55:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351305#M81769</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-19T13:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: min, max, mean, std of values in a single observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351307#M81770</link>
      <description>&lt;P&gt;This worked! Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 13:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/min-max-mean-std-of-values-in-a-single-observation/m-p/351307#M81770</guid>
      <dc:creator>DocMartin</dc:creator>
      <dc:date>2017-04-19T13:59:50Z</dc:date>
    </item>
  </channel>
</rss>

