<?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: How to do calculation in proc means? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724811#M225063</link>
    <description>&lt;P&gt;SAS procedures are pre-fabricated modules with a clearly defined (and limited) set of capabilities.&lt;/P&gt;
&lt;P&gt;If MEANS does not have a specific statistic in its catalog (read the documentation), you have to calculate it yourself.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Mar 2021 10:47:03 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-03-09T10:47:03Z</dc:date>
    <item>
      <title>How to do calculation in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724804#M225059</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;In my code below, I need to use one more datastep to calculate the variable&amp;nbsp;&lt;STRONG&gt;chl_y_c&lt;/STRONG&gt; as below, I am wondering if there is any chance to merge the proc means and data step below together:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=_w.chl_yc_d noprint;
by gviidkey year;
var s_yc_d appday;
output out=chl_yc_d_ (keep=gviidkey year s_yc_y appdaysum where=(appdaysum &amp;gt;=12))
	mean=s_yc_y sum=SC APPDAYSUM;
run;

data chl_yc_final;
	set chl_yc_d_;
		chl_y_c=sqrt(max(4*s_yc_y, 0));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Warmest regards,&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 10:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724804#M225059</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-09T10:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to do calculation in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724809#M225061</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, you can't do calculations like this within PROC MEANS. You could compute the summary statistics &lt;EM&gt;and&lt;/EM&gt; do the calculation in a DATA step or&amp;nbsp;(easier to code, but performance might be worse) in a PROC SQL step, though. But there's nothing wrong with using two separate steps for two different tasks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can make your PROC MEANS step a bit more efficient: Currently you compute the sums&amp;nbsp;&lt;FONT face="courier new,courier"&gt;SC&lt;/FONT&gt; of the &lt;FONT face="courier new,courier"&gt;s_yc_d&lt;/FONT&gt; values per BY group, but you don't keep them in the output dataset. To compute only the sums of &lt;FONT face="courier new,courier"&gt;appday&lt;/FONT&gt; specify&lt;/P&gt;
&lt;PRE&gt;sum&lt;STRONG&gt;(appday)&lt;/STRONG&gt;=APPDAYSUM&lt;/PRE&gt;
&lt;P&gt;in the OUTPUT statement.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 10:45:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724809#M225061</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-03-09T10:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to do calculation in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724811#M225063</link>
      <description>&lt;P&gt;SAS procedures are pre-fabricated modules with a clearly defined (and limited) set of capabilities.&lt;/P&gt;
&lt;P&gt;If MEANS does not have a specific statistic in its catalog (read the documentation), you have to calculate it yourself.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 10:47:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724811#M225063</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-09T10:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to do calculation in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724937#M225095</link>
      <description>&lt;P&gt;Make sure to go through this example for PROC MEANS. There are many ways to control the output from PROC MEANS (not relevant to your question here) to get differently formatted output.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p17h6q7ygvkl1sn13qzf947dundi.htm&amp;amp;locale=en#p17h6q7ygvkl1sn13qzf947dundi" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p17h6q7ygvkl1sn13qzf947dundi.htm&amp;amp;locale=en#p17h6q7ygvkl1sn13qzf947dundi&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 20:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-calculation-in-proc-means/m-p/724937#M225095</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-09T20:01:54Z</dc:date>
    </item>
  </channel>
</rss>

