<?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: Ranking top 10 occurrences from a table in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441680#M28512</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;has the right idea.&amp;nbsp; There are just a few spots where you need to clean up the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;freq&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;have noprint&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; campaign&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;link &lt;FONT color="#FF0000"&gt;/&lt;/FONT&gt; out&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;link_freq&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sort&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;link_freq&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;campaign&lt;/FONT&gt; descending &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; link_freq&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; campaign&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;first&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;campaign &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;SPAN class="token function"&gt;cnt&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN class="token operator"&gt;=&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;SPAN class="token function"&gt;cnt&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;SPAN class="token function"&gt;cnt&lt;/SPAN&gt;&lt;/FONT&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;10&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Mar 2018 18:37:13 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-03-02T18:37:13Z</dc:date>
    <item>
      <title>Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441659#M28509</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a email campaign activity table and I want to calculate the top ten links people have clicked on grouped by each individual campaign ID. I cannot simply do a order by function because I think it will take the overall order across the whole table. I need the top ten unique to table a, the top 10 unique to table b, etc...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would post an example worksheet but I have sensitive data that I am unable to present. I hope I explained my need well enough but feel free to ask for further clarification.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 18:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441659#M28509</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-02T18:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441662#M28510</link>
      <description>&lt;P&gt;Without being able to see your data, let me suggest you use PROC RANK, and use a BY statement to separate the RANKS by table.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 18:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441662#M28510</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-02T18:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441663#M28511</link>
      <description>&lt;P&gt;Use PROC FREQ to calculate the counts.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have noprint;
table campaign*link out=link_freq;
run;

proc sort data=link_freq;
by descending count;
run;

data want;
set link_freq;
by campaign;
if first.campaign then count=0;
else count+1;
if count &amp;lt;= 10;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Mar 2018 18:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441663#M28511</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-02T18:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441680#M28512</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;has the right idea.&amp;nbsp; There are just a few spots where you need to clean up the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;freq&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;have noprint&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; campaign&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;link &lt;FONT color="#FF0000"&gt;/&lt;/FONT&gt; out&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;link_freq&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sort&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;link_freq&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;campaign&lt;/FONT&gt; descending &lt;SPAN class="token function"&gt;count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; link_freq&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; campaign&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;first&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;campaign &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;SPAN class="token function"&gt;cnt&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN class="token operator"&gt;=&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;SPAN class="token function"&gt;cnt&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;FONT color="#FF0000"&gt;&lt;SPAN class="token function"&gt;cnt&lt;/SPAN&gt;&lt;/FONT&gt; &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;10&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Mar 2018 18:37:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441680#M28512</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-02T18:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441692#M28514</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;! Without data it's easy to skip steps sometimes &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 18:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/441692#M28514</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-02T18:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442409#M28546</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems to work. However, the last part seems to only bring back the top 10 rows from the link_freq table. I am looking to get the top 10 per campaign_id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442409#M28546</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T16:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442411#M28547</link>
      <description>&lt;P&gt;Can you post the exact code you used?&lt;/P&gt;
&lt;P&gt;By Campaign should return results for every campaign.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/174883"&gt;@Dogo23&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This seems to work. However, the last part seems to only bring back the top 10 rows from the link_freq table. I am looking to get the top 10 per campaign_id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442411#M28547</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T16:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442414#M28548</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq
data=tableau.activity_match noprint;
table marketing_history_id*link_name / out=link_freq;
run;

proc sort data=link_freq;
by marketing_history_id descending count;
run;

data want;
set link_freq;
by marketing_history_id;
if marketing_history_id then cnt=1;
else cnt+1;
if cnt &amp;lt;= 10;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18969i3A03E9F4D6258577/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:43:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442414#M28548</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T16:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442415#M28549</link>
      <description>&lt;P&gt;It looks correct to me, and it seems like the answer/output is correct if that's the screenshot. The first entry has only 8, so maybe that campaign only had 8 entries for some reason?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442415#M28549</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T16:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442417#M28550</link>
      <description>&lt;P&gt;You're correct that the first entry only had 8 records. However, there are are 500+ of those campaign_ids (marketing_history_id) that are not coming through.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking this should have the top ten for each one. If I change cnt from &amp;lt;=10 to say something like 20, it just brings in the next 20 rows from that table instead. It's almost like saying limit to first 10 rows from the table when I really need the top 10 by ID. Hope that makes sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442417#M28550</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T16:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442419#M28551</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;Here's the data I pulling from in that second step. As you can see, there are more ID's that should be pulled into that final output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18970iA49BBAA17138310A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442419#M28551</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T16:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442421#M28552</link>
      <description>&lt;P&gt;Include the log from the code please, the code appears correct...&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442421#M28552</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T16:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442422#M28553</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='Program';&lt;BR /&gt;4 %LET _CLIENTPROJECTPATH='C:\Users\1364503\Desktop\Dataset For Tableau (002).egp';&lt;BR /&gt;5 %LET _CLIENTPROJECTNAME='Dataset For Tableau (002).egp';&lt;BR /&gt;6 %LET _SASPROGRAMFILE=;&lt;BR /&gt;7&lt;BR /&gt;8 ODS _ALL_ CLOSE;&lt;BR /&gt;9 OPTIONS DEV=ACTIVEX;&lt;BR /&gt;10 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;11 FILENAME EGSR TEMP;&lt;BR /&gt;12 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR&lt;BR /&gt;13 STYLE=HtmlBlue&lt;BR /&gt;14 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")&lt;BR /&gt;15 NOGTITLE&lt;BR /&gt;16 NOGFOOTNOTE&lt;BR /&gt;17 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;18 ENCODING=UTF8&lt;BR /&gt;19 options(rolap="on")&lt;BR /&gt;20 ;&lt;BR /&gt;NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR&lt;BR /&gt;21&lt;BR /&gt;22 GOPTIONS ACCESSIBLE;&lt;BR /&gt;23 proc freq&lt;BR /&gt;24 data=tableau.activity_match noprint;&lt;BR /&gt;25 table marketing_history_id*link_name / out=link_freq;&lt;BR /&gt;26 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 25567356 observations read from the data set TABLEAU.ACTIVITY_MATCH.&lt;BR /&gt;NOTE: The data set WORK.LINK_FREQ has 154424 observations and 4 variables.&lt;BR /&gt;NOTE: PROCEDURE FREQ used (Total process time):&lt;BR /&gt;real time 20.51 seconds&lt;BR /&gt;cpu time 20.52 seconds&lt;/P&gt;&lt;P&gt;27&lt;BR /&gt;28 proc sort data=link_freq;&lt;BR /&gt;29 by marketing_history_id descending count;&lt;BR /&gt;30 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 154424 observations read from the data set WORK.LINK_FREQ.&lt;BR /&gt;NOTE: The data set WORK.LINK_FREQ has 154424 observations and 4 variables.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.20 seconds&lt;BR /&gt;cpu time 0.20 seconds&lt;/P&gt;&lt;P&gt;31&lt;BR /&gt;32 data want;&lt;BR /&gt;33 set link_freq;&lt;BR /&gt;34 by marketing_history_id;&lt;BR /&gt;35 if marketing_history_id then cnt=1;&lt;BR /&gt;36 else cnt+1;&lt;BR /&gt;37 if cnt &amp;lt;= 10;&lt;BR /&gt;38 run;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;35:4&lt;BR /&gt;2 The SAS System 10:02 Monday, March 5, 2018&lt;/P&gt;&lt;P&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=MAINCTA COUNT=16 PERCENT=0.0000625798 FIRST.MARKETING_HISTORY_ID=1&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=1 _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTMYACCCT COUNT=16 PERCENT=0.0000625798 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=2 _ERROR_=1 _N_=2&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTRDMPTS COUNT=16 PERCENT=0.0000625798 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=3 _ERROR_=1 _N_=3&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTRATES COUNT=12 PERCENT=0.0000469348 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=4 _ERROR_=1 _N_=4&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTSPECIAL COUNT=12 PERCENT=0.0000469348 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=5 _ERROR_=1 _N_=5&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTS0105AB COUNT=4 PERCENT=0.0000156449 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=6 _ERROR_=1 _N_=6&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTS0105AM COUNT=4 PERCENT=0.0000156449 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=7 _ERROR_=1 _N_=7&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146825EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146825EN LINK_NAME=TRTS0401AM COUNT=4 PERCENT=0.0000156449 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=1 cnt=8 _ERROR_=1 _N_=8&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=TRTS0106AM COUNT=4 PERCENT=0.0000156449 FIRST.MARKETING_HISTORY_ID=1&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=9 _ERROR_=1 _N_=9&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN&lt;BR /&gt;LINK_NAME=LINK 01 - /CONTENT/GP/EN/HOME.HTML?src={(META:EMAIL_TYPE)}_EMAIL_{(META:CAMPAIGNNAME)}_{(TERRITORY_EMAIL_VERSION)}_{(TRANS&lt;BR /&gt;LATION_LANG)}_{(META:MAIL_DATE)}_SLOT1PR3_{(MARKETING_HISTORY_ID)}_{(LP_MBR_ACCT)} COUNT=2 PERCENT=7.8224749E-6&lt;BR /&gt;FIRST.MARKETING_HISTORY_ID=0 LAST.MARKETING_HISTORY_ID=0 cnt=10 _ERROR_=1 _N_=10&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=MAINCTA COUNT=2 PERCENT=7.8224749E-6 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=11 _ERROR_=1 _N_=11&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=TRTMANAGES COUNT=2 PERCENT=7.8224749E-6 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=12 _ERROR_=1 _N_=12&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=TRTMYACCCT COUNT=2 PERCENT=7.8224749E-6 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=13 _ERROR_=1 _N_=13&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=TRTS0106AB COUNT=2 PERCENT=7.8224749E-6 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=14 _ERROR_=1 _N_=14&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=TRTS0401AB COUNT=2 PERCENT=7.8224749E-6 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=15 _ERROR_=1 _N_=15&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592146826EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592146826EN LINK_NAME=TRTSPECIAL COUNT=2 PERCENT=7.8224749E-6 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=1 cnt=16 _ERROR_=1 _N_=16&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592148156EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592148156EN LINK_NAME=TRTMYACCCT COUNT=28 PERCENT=0.0001095146 FIRST.MARKETING_HISTORY_ID=1&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=17 _ERROR_=1 _N_=17&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592148156EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592148156EN LINK_NAME=TRTS0105AB COUNT=12 PERCENT=0.0000469348 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=18 _ERROR_=1 _N_=18&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592148156EN' , at line 35 column 4.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592148156EN LINK_NAME=TRTS0502AM COUNT=8 PERCENT=0.0000312899 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;3 The SAS System 10:02 Monday, March 5, 2018&lt;/P&gt;&lt;P&gt;LAST.MARKETING_HISTORY_ID=0 cnt=19 _ERROR_=1 _N_=19&lt;BR /&gt;NOTE: Invalid numeric data, MARKETING_HISTORY_ID='A00487002592148156EN' , at line 35 column 4.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;BR /&gt;MARKETING_HISTORY_ID=A00487002592148156EN LINK_NAME=TRTSPECIAL COUNT=8 PERCENT=0.0000312899 FIRST.MARKETING_HISTORY_ID=0&lt;BR /&gt;LAST.MARKETING_HISTORY_ID=0 cnt=20 _ERROR_=1 _N_=20&lt;BR /&gt;NOTE: There were 154424 observations read from the data set WORK.LINK_FREQ.&lt;BR /&gt;NOTE: The data set WORK.WANT has 10 observations and 5 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.06 seconds&lt;BR /&gt;cpu time 0.07 seconds&lt;/P&gt;&lt;P&gt;39&lt;BR /&gt;40 GOPTIONS NOACCESSIBLE;&lt;BR /&gt;41 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;42 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;43 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;44 %LET _SASPROGRAMFILE=;&lt;BR /&gt;45&lt;BR /&gt;46 ;*';*";*/;quit;run;&lt;BR /&gt;47 ODS _ALL_ CLOSE;&lt;BR /&gt;48&lt;BR /&gt;49&lt;BR /&gt;50 QUIT; RUN;&lt;BR /&gt;51&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 16:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442422#M28553</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T16:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442424#M28554</link>
      <description>&lt;P&gt;huh...anything in there look like it's flagging something for you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line)&lt;/SPAN&gt;&lt;IMG class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" border="0" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;SPAN&gt;Column).&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;35:4&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;Finding line 35/4&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;SPAN&gt;35 if &lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;marketing_history_id&lt;/FONT&gt;&lt;SPAN&gt; then cnt=1;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;You forgot the first. portion of that code. Fixing that will fix the issue. Check the original code provided for reference.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 17:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442424#M28554</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T17:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442429#M28555</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't have the fist (bold in code below) in the step. I didn't realize that had to be in the code, but that brought in all the other records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set link_freq;&lt;BR /&gt;by marketing_history_id;&lt;BR /&gt;if &lt;STRONG&gt;first&lt;/STRONG&gt;.marketing_history_id then cnt=1;&lt;BR /&gt;else cnt+1;&lt;BR /&gt;if cnt &amp;lt;= 10;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 17:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442429#M28555</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T17:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442435#M28556</link>
      <description>&lt;P&gt;First. and Last. are used to identify the first and last records in a group, where the grouping variables are defined in the BY statement and that's how&amp;nbsp;SAS knows when to reset the count variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 17:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442435#M28556</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-05T17:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking top 10 occurrences from a table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442444#M28557</link>
      <description>&lt;P&gt;Makes sense. Thanks for the explanation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 17:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Ranking-top-10-occurrences-from-a-table/m-p/442444#M28557</guid>
      <dc:creator>Dogo23</dc:creator>
      <dc:date>2018-03-05T17:40:39Z</dc:date>
    </item>
  </channel>
</rss>

