<?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: Assitance with a Count + Amount from a large table. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274643#M58507</link>
    <description>&lt;P&gt;Thank you for the swift responses, they both make complete sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These two will sum the Amount variable correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If i wanted to show the count of obervations from the same criteria could I do that in a similar way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again thank you for the help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stret&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jun 2016 12:56:23 GMT</pubDate>
    <dc:creator>Stretlow</dc:creator>
    <dc:date>2016-06-02T12:56:23Z</dc:date>
    <item>
      <title>Assistance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274622#M58504</link>
      <description>&lt;P&gt;Hello there. I'm after some more help if I may.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've been asked to extract some numbers from a partularly large table. I would normally use a data step but the table is massive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The columns I would use would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID / Date / Amount / IntCode / Currency&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to summarise 12 months worth of data and to extract it would take some time I believe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a Proc Summary procedure whereby I could say:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If the date is in 2012 and the Currency is 978 then show me the Count of records and the sumed value of the amount column?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not great with Proc procedures so appologies in advance for the basic question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stret&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 12:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274622#M58504</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-06-02T12:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274631#M58505</link>
      <description>&lt;P&gt;Hi, maybe something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=massive
 (where=(year(date)=2012 and currency=978));
var amount;
output out=result n=N sum=Sum;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Assuming Currency is some sort of code, not a variable you need to summarize.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 12:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274631#M58505</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-06-02T12:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Assitance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274632#M58506</link>
      <description>&lt;P&gt;Basic tools that you'll need to know eventually ... here's a shell of a program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc means data=have sum n nmiss;&lt;/P&gt;
&lt;P&gt;var amount;&lt;/P&gt;
&lt;P&gt;where /* something here to subset records */;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The WHERE statement depends on what your data actually contains.&amp;nbsp; Is CURRENCY character or numeric?&amp;nbsp; Is DATE a SAS date value or a datetime value?&amp;nbsp; For one set of answers, this would match:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where currency='978' and year(date) = 2012;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the fastest solution might conceivably be a DATA step, if there is a known order to the observations.&amp;nbsp; For example, if the records are sorted by DATE, a DATA step could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if year(date) &amp;gt; 2012 then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; * print results;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; stop;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then there would be no need to examine the remaining records.&amp;nbsp; (The WHERE statement has to examine all records even if it doesn't use them in the computations.)&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 12:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274632#M58506</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-02T12:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Assitance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274643#M58507</link>
      <description>&lt;P&gt;Thank you for the swift responses, they both make complete sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These two will sum the Amount variable correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If i wanted to show the count of obervations from the same criteria could I do that in a similar way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again thank you for the help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stret&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 12:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274643#M58507</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-06-02T12:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Assitance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274646#M58508</link>
      <description>&lt;P&gt;Both will sum AMOUNT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The primary difference:&amp;nbsp; PROC SUMMARY does not print its result by default.&amp;nbsp; So the OUTPUT statement creates a SAS data set holding the summary.&amp;nbsp; PROC MEANS prints its results by default.&amp;nbsp; You can add an OUTPUT statement to it, but that's not needed if all&amp;nbsp; you want is a printed report.&amp;nbsp; PROC SUMMARY and PROC MEANS have the exact same capabilities, but with different defaults.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output data set will contain an automatic variable _FREQ_ which is an observation count.&amp;nbsp; The statistics N and NMISS combined should always sum to the value of _FREQ_.&amp;nbsp; N=number of observations with a valid (nonmissing) value for AMOUNT, NMISS=number of observations with a missing value for AMOUNT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Test on a small amount of data, if that's possible, to see what fits&amp;nbsp; your needs.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 13:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274646#M58508</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-02T13:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Assitance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274648#M58509</link>
      <description>&lt;P&gt;Thank you for taking the time to respond&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stret&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2016 13:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/274648#M58509</guid>
      <dc:creator>Stretlow</dc:creator>
      <dc:date>2016-06-02T13:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with a Count + Amount from a large table.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/275173#M58540</link>
      <description>Investigate if there are any indexes defined for the source table. The extraction could probably benefit with an index on currency. Year is more difficult since the where optimizer have problems with function calls. If year is a regular requirement consider adding that as a column, or perhaps use a separate time dimension table.</description>
      <pubDate>Sat, 04 Jun 2016 09:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Assistance-with-a-Count-Amount-from-a-large-table/m-p/275173#M58540</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-04T09:41:13Z</dc:date>
    </item>
  </channel>
</rss>

