<?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: Proc Report: Count and Sum for same variable in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909598#M40697</link>
    <description>&lt;P&gt;As always, Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;It contains&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0pvcjm1isi9q9n1pxziic5aq3fz.htm" target="_blank" rel="noopener"&gt;this example&lt;/A&gt;&amp;nbsp;for having multiple statistics for one variable without the use of aliases.&lt;/P&gt;
&lt;P&gt;But N is a special case, as it does not depend on a variable, but counts the&amp;nbsp;&lt;EM&gt;observations&lt;/EM&gt; instead.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Dec 2023 19:32:13 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-12-24T19:32:13Z</dc:date>
    <item>
      <title>Proc Report: Count and Sum for same variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909592#M40694</link>
      <description>&lt;DIV class=""&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT face="courier new,courier"&gt;proc report data=deposits nowd;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;column cust_id &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;amount_deposited&amp;nbsp; &amp;nbsp; &amp;nbsp;amount_deposited=deposit_count&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;amount_withdrawn&amp;nbsp; &amp;nbsp; amount_withdrawn=withdraw_count&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;avg_dep_amt&amp;nbsp; &amp;nbsp; avg_tran_count&amp;nbsp; &amp;nbsp; &amp;nbsp;avg_wdraw_count;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define cust_id/ group;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define amount_deposited / analysis sum noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define amount_withdrawn / analysis sum noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define deposit_count/ analysis n noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define withdraw_count/ analysis n noprint;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define avg_dep_amt / computed 'avg. deposit amount';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define avg_tran_count / computed 'avg. no. of transactions';&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;define avg_wdraw_count / computed 'avg. no. of withdrawals';&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;compute avg_dep_amt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;avg_dep_amt = amount_deposited/deposit_count;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;endcomp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;compute avg_tran_count;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;avg_tran_count = (deposit_count + withdraw_count)/3;&amp;nbsp; /* there is a reason to divide by 3 */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;endcomp;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;compute avg_wdraw_count;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;avg_wdraw_count = withdraw_count/3;&amp;nbsp; &amp;nbsp;/* there is a reason to divide by 3 */&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;endcomp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;STRONG&gt;Log:&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: Variable amount_deposited is uninitialized.&lt;/DIV&gt;&lt;DIV class=""&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.&lt;/DIV&gt;&lt;DIV class=""&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;/DIV&gt;&lt;DIV class=""&gt;5 at 1:32&lt;BR /&gt;&lt;BR /&gt;I can compute count the number of non-missing values of variable amount_deposited using alias, but I cannot compute sum of those values, log shows me that the variable is not initialized. What is the problem in SAS?&lt;/DIV&gt;</description>
      <pubDate>Sun, 24 Dec 2023 17:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909592#M40694</guid>
      <dc:creator>Sayan7</dc:creator>
      <dc:date>2023-12-24T17:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report: Count and Sum for same variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909594#M40695</link>
      <description>&lt;P&gt;With a non-aliased variable, you must also specify the statistic, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;avg_dep_amt = amount_deposited.sum / deposit_count;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Dec 2023 18:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909594#M40695</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-12-24T18:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report: Count and Sum for same variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909595#M40696</link>
      <description>&lt;P&gt;In that case can I define like:&lt;/P&gt;&lt;PRE&gt;define amount_deposited / analysis sum n noprint;&lt;/PRE&gt;&lt;P&gt;in order to find:&lt;/P&gt;&lt;PRE&gt;avg_dep_amt = amount_deposited.sum / amount_deposited.n ;&lt;/PRE&gt;&lt;P&gt;instead making a new variable?&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 18:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909595#M40696</guid>
      <dc:creator>Sayan7</dc:creator>
      <dc:date>2023-12-24T18:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report: Count and Sum for same variable</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909598#M40697</link>
      <description>&lt;P&gt;As always, Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;It contains&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0pvcjm1isi9q9n1pxziic5aq3fz.htm" target="_blank" rel="noopener"&gt;this example&lt;/A&gt;&amp;nbsp;for having multiple statistics for one variable without the use of aliases.&lt;/P&gt;
&lt;P&gt;But N is a special case, as it does not depend on a variable, but counts the&amp;nbsp;&lt;EM&gt;observations&lt;/EM&gt; instead.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Dec 2023 19:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Report-Count-and-Sum-for-same-variable/m-p/909598#M40697</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-12-24T19:32:13Z</dc:date>
    </item>
  </channel>
</rss>

