<?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: SAS PROGRAMMING in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695269#M212148</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272464"&gt;@aashish_jain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you please be so kind as to change the Subject of your post from "SAS PROGRAMMING" to a subject that actually describes the problem you are trying to solve? Thank you. This helps everyone with similar problems to find posts about it. If all posts had the subject line "SAS PROGRAMMING", this forum would be useless to most people.&lt;/P&gt;</description>
    <pubDate>Thu, 29 Oct 2020 16:55:35 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-10-29T16:55:35Z</dc:date>
    <item>
      <title>Compute top 2 state and top 5 cities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695267#M212146</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA A;
length state $20 city $30;
INPUT STATE$ CITY$ POP;
CARDS;
MAHA PUNE 200
MAHA SATARA 300
MAHA MUMB 250
MAHA NAGPUR 50
MAHA SOLAPUR 56
MAHA KOLAHPUR 88
GUJ GANDHINGR 20
GUJ AHMDABAD 40
GUJ PORBUNDR 55
GUJ SURAT 66
GUJ VADODRA 99
GUJ RAJKOT 100
UP LUCKNOW 98
UP AGRA 66
UP KANPUR 55
UP GZB 39
UP BAREILLY 22
UP VARANASI 66
;
RUN;&lt;BR /&gt;&lt;BR /&gt;IF&amp;nbsp;i&amp;nbsp;have&amp;nbsp;&amp;nbsp;a&amp;nbsp;data&amp;nbsp;like&amp;nbsp;this&amp;nbsp;and&amp;nbsp;i&amp;nbsp;want&amp;nbsp;to&amp;nbsp;calculate&amp;nbsp;top&amp;nbsp;2&amp;nbsp;state&amp;nbsp;based&amp;nbsp;upon&amp;nbsp;max&amp;nbsp;population&amp;nbsp;and&amp;nbsp;along&amp;nbsp;with&amp;nbsp;its&amp;nbsp;top&amp;nbsp;5&amp;nbsp;cities,how would i do it?&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695267#M212146</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2020-10-29T17:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS PROGRAMMING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695268#M212147</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272464"&gt;@aashish_jain&lt;/a&gt;&amp;nbsp; Please take a look at PROC RANK. That should do what you are after.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; happy? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695268#M212147</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-10-29T16:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS PROGRAMMING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695269#M212148</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/272464"&gt;@aashish_jain&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would you please be so kind as to change the Subject of your post from "SAS PROGRAMMING" to a subject that actually describes the problem you are trying to solve? Thank you. This helps everyone with similar problems to find posts about it. If all posts had the subject line "SAS PROGRAMMING", this forum would be useless to most people.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 16:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695269#M212148</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-29T16:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS PROGRAMMING</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695277#M212151</link>
      <description>&lt;P&gt;I believe this will be done in 2 steps, proc rank can be used,&lt;/P&gt;&lt;P&gt;But I tried first and last dot but only one solution is achievable not both.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695277#M212151</guid>
      <dc:creator>aashish_jain</dc:creator>
      <dc:date>2020-10-29T17:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compute top 2 state and top 5 cities</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695310#M212166</link>
      <description>&lt;P&gt;You want&lt;/P&gt;
&lt;P&gt;"IF i have a data like this and i want to calculate top 2 state based upon max population and along with its top 5 cities,how would i do it?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By top 2 states, I presume you intend to total up population for all cities within each state, and take the 2 largest states.&amp;nbsp; And from there, you want the largest 5 cities in each of those states, right?&amp;nbsp; &amp;nbsp;If so, proc rank won't work until you select the states.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider proc summary as a way to generate state totals in a summary data set.&amp;nbsp; Then choose the two largest totals and merge that with your city dataset based on the state identifier.&amp;nbsp; You could then run a proc rank, to produce city ranks within state, and filter out cities without a qualifying city rank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, what if you have ties in state totals or city populations?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 18:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Compute-top-2-state-and-top-5-cities/m-p/695310#M212166</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-29T18:56:36Z</dc:date>
    </item>
  </channel>
</rss>

