<?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: Freq and SUM in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367522#M19280</link>
    <description>&lt;P&gt;Your example doesn't contain a variable called firm, your second question pertains to a different dataset, and I'm still not sure what level of summary you're looking for or how you are defining the previous 6 month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you looking for something like:&lt;/P&gt;
&lt;PRE&gt;proc import datafile='/folders/myfolders/sample.xlsx' out=dailypa dbms=xlsx replace;
run;

proc freq data=dailypa (where=(date between intnx('month',today(),-7,'b') and
                                            intnx('month',today(),-1,'e') ));
  tables permno * year * month / noprint out=monthly_counts ;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2017 21:53:50 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-06-15T21:53:50Z</dc:date>
    <item>
      <title>Frequency and SUMmation for prior six months</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367492#M19276</link>
      <description>&lt;P&gt;Hello, Friends, i have two questions; I have attached a sample data file.&lt;/P&gt;&lt;P&gt;I am using daily data, which has a number of firms and years. and i am looking to calculate following two things for each firm.&lt;/P&gt;&lt;P&gt;1) I want to calculate the frequency of a variable for last six month. I am using following data which can calculate over a month. can some one suggest how can i include prior 6 months&amp;gt;?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq data=dailypa;&lt;BR /&gt;tables Firm * year * month / noprint out=monthly_counts ;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) my second question is also similar except i want to get a summation of a variable over prior six-month. The following code is useful for a month only.&lt;/P&gt;&lt;P&gt;proc summary data=illiquid nway;&lt;BR /&gt;class Firm year month;&lt;BR /&gt;var XYZ;&lt;BR /&gt;output out=summary_data (keep=firm year month total_ratio) sum=total_ratio; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciatable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367492#M19276</guid>
      <dc:creator>Kyojik</dc:creator>
      <dc:date>2017-06-15T20:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Freq and SUM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367496#M19277</link>
      <description>&lt;P&gt;You didn't provide an example of what your data look like, but you can always include a where option (e.g., data=dailypa(where=(..))&lt;/P&gt;
&lt;P&gt;If your data includes a date variable, you could specify something like where=date between intnx('month',today(),-6,'s') and today() ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, you could use the combination of year= and month in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And, if you want those calculations to be overall, rather than by month, simply leave month out of your class and table specs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367496#M19277</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-15T20:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Freq and SUM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367500#M19279</link>
      <description>I have added a EXCEL file of sample data and want a summation of XYZ variable for prior six months. The frequency of date variables.&lt;BR /&gt;Thank you&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jun 2017 20:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367500#M19279</guid>
      <dc:creator>Kyojik</dc:creator>
      <dc:date>2017-06-15T20:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Freq and SUM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367522#M19280</link>
      <description>&lt;P&gt;Your example doesn't contain a variable called firm, your second question pertains to a different dataset, and I'm still not sure what level of summary you're looking for or how you are defining the previous 6 month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you looking for something like:&lt;/P&gt;
&lt;PRE&gt;proc import datafile='/folders/myfolders/sample.xlsx' out=dailypa dbms=xlsx replace;
run;

proc freq data=dailypa (where=(date between intnx('month',today(),-7,'b') and
                                            intnx('month',today(),-1,'e') ));
  tables permno * year * month / noprint out=monthly_counts ;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 21:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367522#M19280</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-15T21:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Freq and SUM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367524#M19281</link>
      <description>I think i failed to made my point earlier.&lt;BR /&gt;Firm is permno is the file.&lt;BR /&gt;the code you wrote calculate it month wise, like&lt;BR /&gt;Month count want_Variable&lt;BR /&gt;1 12&lt;BR /&gt;2 10&lt;BR /&gt;3 5&lt;BR /&gt;4 4&lt;BR /&gt;5 20&lt;BR /&gt;6 10&lt;BR /&gt;7 61 (sum of six previous month)&lt;BR /&gt;&lt;BR /&gt;i hope its clear now.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jun 2017 22:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367524#M19281</guid>
      <dc:creator>Kyojik</dc:creator>
      <dc:date>2017-06-15T22:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Freq and SUM</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367532#M19282</link>
      <description>&lt;P&gt;Still not clear as there are a number of ways to achieve what you showed. Do you want something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile='/folders/myfolders/sample.xlsx' out=dailypa dbms=xlsx replace;
run;

proc freq data=dailypa (where=(date between intnx('month',today(),-7,'b') and
                                            intnx('month',today(),-1,'e') ));
  tables permno * year * month / noprint out=monthly_counts ;
run;

proc print data=monthly_counts;
  sum count;
  by permno;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 22:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Frequency-and-SUMmation-for-prior-six-months/m-p/367532#M19282</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-06-15T22:17:48Z</dc:date>
    </item>
  </channel>
</rss>

