<?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: Rank Top Ten in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483959#M31386</link>
    <description>&lt;P&gt;You will need an extra step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table t1 as
select 
    marketing_history_id,
    link_name,
    count(email_campaign_activity_id) as total
from email_campaign_activity 
where datepart(activity_date) &amp;gt;= '01JAN2018'd
group by marketing_history_id, link_name
order by marketing_history_id, total desc;
quit;

data want;
do i = 1 by 1 until (last.marketing_history_id);
    set t1; by marketing_history_id;
    if i &amp;lt;= 5 then output;
    end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 04 Aug 2018 03:16:55 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-08-04T03:16:55Z</dc:date>
    <item>
      <title>Rank Top Ten</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483930#M31383</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following query in the attempt to count top 5 clicks on a certain link by each campaign. The query I used only counted the top 5 records overall, where as I needed it to count the top 5 for each campaign (marketing_history_id. Any suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output I get with this code is attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs=5;
create table t1 as
select marketing_history_id,
link_name,
count(email_campaign_activity_id) as total
from email_campaign_activity 
and datepart(activity_date) &amp;gt;= '01JAN2018'd
group by 1,2
order by total desc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 529px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22212i32DC34932E338ECA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 21:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483930#M31383</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-08-03T21:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Top Ten</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483931#M31384</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/174883"&gt;@Dogo23&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following query in the attempt to count top 5 clicks on a certain link by each campaign. The query I used only counted the top 5 records overall, where as I needed it to count the top 5 for each campaign (marketing_history_id. Any suggestions?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output I get with this code is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql outobs=5;
create table t1 as
select marketing_history_id,
link_name,
count(email_campaign_activity_id) as total
from email_campaign_activity 
and datepart(activity_date) &amp;gt;= '01JAN2018'd
group by 1,2
order by total desc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect that you want:&lt;/P&gt;
&lt;P&gt;Group by marketing_history_id&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 21:44:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483931#M31384</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-03T21:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: Rank Top Ten</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483959#M31386</link>
      <description>&lt;P&gt;You will need an extra step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table t1 as
select 
    marketing_history_id,
    link_name,
    count(email_campaign_activity_id) as total
from email_campaign_activity 
where datepart(activity_date) &amp;gt;= '01JAN2018'd
group by marketing_history_id, link_name
order by marketing_history_id, total desc;
quit;

data want;
do i = 1 by 1 until (last.marketing_history_id);
    set t1; by marketing_history_id;
    if i &amp;lt;= 5 then output;
    end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Aug 2018 03:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Rank-Top-Ten/m-p/483959#M31386</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-08-04T03:16:55Z</dc:date>
    </item>
  </channel>
</rss>

