<?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: what is the efficient query to solve this in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148691#M39332</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, that perhaps does happen and I noticed that too. That's of course sad and aweful.Well, I guess some are &lt;STRONG&gt;so desperate&lt;/STRONG&gt; to be in SAS based careers as a means to make ends meet I suppose:smileyconfused:, and to make sure they stay in the job and get paid&amp;nbsp; they resort to other avenues such as the communities or SAS L. Weird eh?lol that's how the world wide web works, isn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have asked many many times too,many times I got the help and other times I have not received any at all. That's normal.&lt;STRONG&gt; I don't think there are any rules by the owner of SAS communities or SAS Institute that forbids people from asking questions of this type in particular as I believe forum is free and open to all and whether to respond or not is the individual's choice.&lt;/STRONG&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Feb 2015 04:38:50 GMT</pubDate>
    <dc:creator>Allaluiah</dc:creator>
    <dc:date>2015-02-03T04:38:50Z</dc:date>
    <item>
      <title>what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148683#M39324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hii all i have to data like this&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 412px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="40" width="53"&gt;Emp_id&lt;/TD&gt;&lt;TD class="xl70" style="border-left: none;" width="60"&gt;contract_type&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="35"&gt;year&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="99"&gt;no_of_policies&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="64"&gt;&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="101"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;101&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl66"&gt;10&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;101&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;15&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;101&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;20&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;"&gt;45&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;101&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;5&lt;/TD&gt;&lt;TD class="xl68"&gt;45&amp;gt;=36&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;101&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;12&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;101&lt;/TD&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;10&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;72&lt;/TD&gt;&lt;TD class="xl68"&gt;DEVIDED/2=36&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD class="xl69"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;30&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;18&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;26&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;"&gt;74&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;12&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;9&lt;/TD&gt;&lt;TD class="xl68"&gt;74&amp;gt;=51&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD align="right"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;7&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;102&lt;/TD&gt;&lt;TD class="xl68"&gt;DEVIDED/2=51&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD class="xl69"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD align="right"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;78&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD align="right"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;45&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD align="right"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;65&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-left: none;"&gt;188&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;D&lt;/TD&gt;&lt;TD align="right"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;35&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;E&lt;/TD&gt;&lt;TD align="right"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;80&lt;/TD&gt;&lt;TD class="xl68"&gt;188 IS NOT&amp;gt;199&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl67" height="20"&gt;102&lt;/TD&gt;&lt;TD&gt;F&lt;/TD&gt;&lt;TD align="right"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl65" style="border-top: none;"&gt;95&lt;/TD&gt;&lt;TD class="xl68"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65"&gt;398&lt;/TD&gt;&lt;TD class="xl68"&gt;DEVIDED /2=199&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl67" height="20"&gt;&lt;/TD&gt;&lt;TD class="xl69"&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;the contract_type A,B,C are consider as one group i.e. REG_POL.&lt;/P&gt;&lt;P&gt;what my requirement is that in 2010 year the emp 101 is done 72 policies. In that the group of REG_POL share is 45 .&lt;/P&gt;&lt;P&gt;then may find that the total no of policies in that perticular year devided by 2.&lt;/P&gt;&lt;P&gt;the REG_POL value should be greater of than of this (no_of_policies/2) .&lt;/P&gt;&lt;P&gt;The final output we want only that employees who done their maximum policies in REG_GROUP. we need only that type of employees. if not ignore that employee.&lt;/P&gt;&lt;P&gt;in above example the first two employees are selected. and the third employee is rejected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please give your valid comments to solve this type of query. using the what ever procedure i trying to by using proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: ravikumar kummari&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 08:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148683#M39324</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-02-02T08:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148684#M39325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not a place where you can expect someone else to do your job - just help you with specific problems.&lt;/P&gt;&lt;P&gt;Try to solve your query first by yourself, then get back with a more specific question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 09:01:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148684#M39325</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-02-02T09:01:27Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148685#M39326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Yes, please do try something out before posting . Here's how you can approach your problem if you're not really sure where/how to start. Come up with a design on how to solve this, split the problem into multiple steps and&amp;nbsp; create a simple program for each step, then you can work on optimizing your program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your Data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAMPLE&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="320"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl64" height="40" width="64"&gt;Obs&lt;/TD&gt;&lt;TD class="xl65" width="64"&gt;emp_id&lt;/TD&gt;&lt;TD class="xl65" width="64"&gt;contract_type&lt;/TD&gt;&lt;TD class="xl65" width="64"&gt;year&lt;/TD&gt;&lt;TD class="xl65" width="64"&gt;no_of_policies&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;1&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;101&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;2&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;101&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;B&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;3&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;101&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;C&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;4&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;101&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;D&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;5&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;101&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;E&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;6&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;101&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;F&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;7&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;8&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;B&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;9&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;C&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;10&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;D&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;11&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;E&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;12&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;F&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2010&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;13&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;A&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;78&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;14&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;B&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;15&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;C&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;65&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;16&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;D&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;35&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;17&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;E&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;80&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;18&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;102&lt;/TD&gt;&lt;TD class="xl63" width="64"&gt;F&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;2011&lt;/TD&gt;&lt;TD align="right" class="xl63" width="64"&gt;95&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table data1 as &lt;/P&gt;&lt;P&gt;select emp_id ,year , sum(no_of_policies) as reg_pol&lt;/P&gt;&lt;P&gt;from sample&lt;/P&gt;&lt;P&gt;where contract_type in('A','B','C')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;group by emp_id, year&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table data2 as &lt;/P&gt;&lt;P&gt;select emp_id , year , sum(no_of_policies)/2 as divby_2&lt;/P&gt;&lt;P&gt;from sample&lt;/P&gt;&lt;P&gt;group by emp_id, year&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data = data1 ; by emp_id year;run;&lt;/P&gt;&lt;P&gt;proc sort data = data2 ; by emp_id year;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA1:&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="256"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;&lt;STRONG&gt;Obs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;emp_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;year&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;reg_pol&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;101&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2010&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;45&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;102&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2010&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;74&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;102&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2011&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;188&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="256"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;&lt;STRONG&gt;Obs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;emp_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;year&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;divby_2&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;101&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2010&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;36&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;102&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2010&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;51&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;102&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2011&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;199&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;merge&lt;/P&gt;&lt;P&gt;data1&lt;/P&gt;&lt;P&gt;data2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;by emp_id year;&lt;/P&gt;&lt;P&gt;if reg_pol &amp;gt;= divby_2 then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FINAL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="320"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" width="64"&gt;&lt;STRONG&gt;Obs&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;emp_id&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;year&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;reg_pol&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD class="xl67" width="64"&gt;&lt;STRONG&gt;divby_2&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;101&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2010&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;45&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;36&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl68" height="20" width="64"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;102&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;2010&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;74&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD align="right" class="xl65" width="64"&gt;&lt;STRONG&gt;51&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Karthik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 09:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148685#M39326</guid>
      <dc:creator>Karthikeyan</dc:creator>
      <dc:date>2015-02-02T09:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148686#M39327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have actual pretty much written it yourself in your logic there.&amp;nbsp; Just need to code it.&amp;nbsp; Check out SUM() function with group by emp_id/year, then left join that back to main table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 09:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148686#M39327</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-02T09:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148687#M39328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understood what you mean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
data have;
input Emp_id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contract_type $&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;year&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;no_of_policies&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;;
cards;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;E&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;E&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2010&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;78&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;65&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;D&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;E&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
103&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;G&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
;
run;
proc sql;
 create table want as
&amp;nbsp; select * from have 
&amp;nbsp;&amp;nbsp; group by Emp_id
&amp;nbsp;&amp;nbsp;&amp;nbsp; having sum(contract_type in ('A' 'B' 'C')) ge count(*)/2;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 09:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148687#M39328</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-02-02T09:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148688#M39329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Break it down into simpler problems, here's one way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Find the total of all policies by employee_id and divide by 2&lt;/P&gt;&lt;P&gt;2. Merge result back into table&lt;/P&gt;&lt;P&gt;3. Calculate running total&lt;/P&gt;&lt;P&gt;4. Flag if greater than number found in part #1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 10:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148688#M39329</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-02T10:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148689#M39330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Feel free to post any number of queries. &lt;STRONG&gt;I think that's what the forum is for. If somebody wants to help, they will and if they don't, well they don't&lt;/STRONG&gt;. &lt;STRONG&gt;If somebody is unhappy that you asked such a question, well it's their problem&lt;/STRONG&gt;. It is one of these kind of queries on Feb16th,2000 that made the greatest SAS programmer ever produced &lt;STRONG&gt;Mr. Ian whitlock&lt;/STRONG&gt; popular or known in the wider SAS world. As a matter of fact, the different kind of solutions that people attempt eventually become research papers for other SAS greats like Paul Dorfman, Toby Dunn et al. The ones who have become experts were all learners once. So Don't worry and just learn from other's solutions so that one day sooner or later you will be happy to provide solutions for other newbies.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the best!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 02:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148689#M39330</guid>
      <dc:creator>Allaluiah</dc:creator>
      <dc:date>2015-02-03T02:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148690#M39331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its one thing to post multiple queries, its another to post multiple queries, multiple times and under different names. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 04:13:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148690#M39331</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-03T04:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148691#M39332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, that perhaps does happen and I noticed that too. That's of course sad and aweful.Well, I guess some are &lt;STRONG&gt;so desperate&lt;/STRONG&gt; to be in SAS based careers as a means to make ends meet I suppose:smileyconfused:, and to make sure they stay in the job and get paid&amp;nbsp; they resort to other avenues such as the communities or SAS L. Weird eh?lol that's how the world wide web works, isn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have asked many many times too,many times I got the help and other times I have not received any at all. That's normal.&lt;STRONG&gt; I don't think there are any rules by the owner of SAS communities or SAS Institute that forbids people from asking questions of this type in particular as I believe forum is free and open to all and whether to respond or not is the individual's choice.&lt;/STRONG&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Feb 2015 04:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148691#M39332</guid>
      <dc:creator>Allaluiah</dc:creator>
      <dc:date>2015-02-03T04:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: what is the efficient query to solve this</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148692#M39333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank u &lt;A _jive_internal="true" data-avatarid="-1" data-externalid="" data-online="false" data-presence="null" data-userid="815868" data-username="Allaluiah" href="https://communities.sas.com/people/Allaluiah" style="font-weight: bold; font-size: 11.6999998092651px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #8b8b8b; background-color: #ffffff;"&gt;Allaluiah&lt;/A&gt;. I want cooperation like you sir. If we are beginners and asking some of doubts and queries how to solve it.&lt;/P&gt;&lt;P&gt;I appreciate what you said. But what is the main problem in this sas community some of persons are feeling over enthusiasm and replying why you are posting&amp;nbsp; unnecessary. and saying why you are doing your work with others.&lt;/P&gt;&lt;P&gt;my sincere advise is if you know answer and if you like to do post answer those people are welcome. But if you know answer and not even like to post the answer then keep silence don't questioned other one. and judge them. its my humble advise. No one knows all in this world. We know little bit only. SAS its a ocean there is a lot of concepts and procedures in this. So No one knows all.&lt;/P&gt;&lt;P&gt;And once again thank u&amp;nbsp;&amp;nbsp; Allaluiah sir for encouraging every one to post in sas community.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Feb 2015 10:33:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/what-is-the-efficient-query-to-solve-this/m-p/148692#M39333</guid>
      <dc:creator>Ravikumarkummari</dc:creator>
      <dc:date>2015-02-10T10:33:38Z</dc:date>
    </item>
  </channel>
</rss>

