<?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: Selecting Top 10 records based on the variable in Price freq in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468685#M119757</link>
    <description>&lt;P&gt;The article &lt;A href="https://blogs.sas.com/content/iml/2018/06/04/top-10-table-bar-chart.html" target="_self"&gt;"An easy way to make a "Top 10" table and bar chart in SAS" &lt;/A&gt;shows how.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; is mistaken about needing the latest version of SAS. This option is available in any version of SAS 9.4, and SAS 9.4M0 shipped way back in in 2013.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you aren't using SAS 9.4, there is a link in the blog post to an older technique.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jun 2018 13:19:57 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2018-06-08T13:19:57Z</dc:date>
    <item>
      <title>Selecting Top 10 records based on the variable in Price freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468520#M119681</link>
      <description>How to select Top 10 records based on the variable in Proc Freq? Thanks in advance&lt;BR /&gt;&lt;BR /&gt;I did the order = freq however I’m trying to compare the metrics by Week...when I do the order = freq it gives me in descending but not the weeks in order (week1, week2, week3) etc. also how do I choose the top 10 counts?&lt;BR /&gt;&lt;BR /&gt;Please advise. Thank you</description>
      <pubDate>Thu, 07 Jun 2018 20:17:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468520#M119681</guid>
      <dc:creator>pappusrini</dc:creator>
      <dc:date>2018-06-07T20:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Top 10 records based on the variable in Price freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468528#M119685</link>
      <description>&lt;P&gt;What do you mean by "choose"? Are you attempting to create a subset of the data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do we know what a "week" might be? Do you have a variable named week? Dates that have to be assigned to a week?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should provide a small example of data as you have now and then show what the desired result would be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might try 1) sort your data by week and 2) run your proc freq with a BY week. That should get the order within each week value, if that is what you have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your request is not quite clear because you could be wanting just the counts or sub-setting the data to get the records that provided a count.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could demonstrate the logic with fewer records if using "top 3" instead of "top 10".&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 20:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468528#M119685</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-07T20:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Top 10 records based on the variable in Price freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468542#M119690</link>
      <description>&lt;P&gt;Here's a possibility based on a few reasonable guesses as to what the results should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=have;&lt;/P&gt;
&lt;P&gt;tables week * metric / noprint out=counts;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=counts;&lt;/P&gt;
&lt;P&gt;by week descending count;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set counts;&lt;/P&gt;
&lt;P&gt;by week;&lt;/P&gt;
&lt;P&gt;if first.week then rank = 1;&lt;/P&gt;
&lt;P&gt;else rank + 1;&lt;/P&gt;
&lt;P&gt;if rank &amp;lt;= 10;&lt;/P&gt;
&lt;P&gt;keep week metric count;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 21:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468542#M119690</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-07T21:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Top 10 records based on the variable in Price freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468671#M119749</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;just wrote a blog about it . But you need the newest SAS version.&lt;/P&gt;
&lt;P&gt;proc freq data=have order=freq;&lt;/P&gt;
&lt;P&gt;table x/ maxlevels=10;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 12:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468671#M119749</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-08T12:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Top 10 records based on the variable in Price freq</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468685#M119757</link>
      <description>&lt;P&gt;The article &lt;A href="https://blogs.sas.com/content/iml/2018/06/04/top-10-table-bar-chart.html" target="_self"&gt;"An easy way to make a "Top 10" table and bar chart in SAS" &lt;/A&gt;shows how.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; is mistaken about needing the latest version of SAS. This option is available in any version of SAS 9.4, and SAS 9.4M0 shipped way back in in 2013.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you aren't using SAS 9.4, there is a link in the blog post to an older technique.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 13:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-Top-10-records-based-on-the-variable-in-Price-freq/m-p/468685#M119757</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-06-08T13:19:57Z</dc:date>
    </item>
  </channel>
</rss>

