<?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 How to select a number of variables by variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347474#M80276</link>
    <description>&lt;P&gt;hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a base on SAS with about 200.000 rows, and there is 10 different agents os that base&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to select 200 rows by&amp;nbsp;agent, with priorities, like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;priority &amp;nbsp; ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;agent&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 005431 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&gt;&lt;SPAN&gt;20541 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;136751 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;057366&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;012658&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;057317&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;012856&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;way i need to select them is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;first, put everything with priority 1 for agent A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if its not complete with 200 rows, put priority 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and so on&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;anyone knows how can I do it?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2017 17:20:03 GMT</pubDate>
    <dc:creator>letmmattos</dc:creator>
    <dc:date>2017-04-05T17:20:03Z</dc:date>
    <item>
      <title>How to select a number of variables by variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347474#M80276</link>
      <description>&lt;P&gt;hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a base on SAS with about 200.000 rows, and there is 10 different agents os that base&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to select 200 rows by&amp;nbsp;agent, with priorities, like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;priority &amp;nbsp; ID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;agent&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 005431 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/SPAN&gt;&lt;SPAN&gt;20541 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;136751 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;057366&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;012658&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;057317&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;012856&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;way i need to select them is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;first, put everything with priority 1 for agent A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if its not complete with 200 rows, put priority 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and so on&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;anyone knows how can I do it?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 17:20:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347474#M80276</guid>
      <dc:creator>letmmattos</dc:creator>
      <dc:date>2017-04-05T17:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a number of variables by variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347480#M80278</link>
      <description>&lt;P&gt;1. Sort by Agent, Priority&lt;/P&gt;
&lt;P&gt;2. Count records for each by group and take the top 200 per agent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;by agent priority;&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 have;&lt;/P&gt;
&lt;P&gt;by agent;&lt;/P&gt;
&lt;P&gt;if first.agent then count=1;&lt;/P&gt;
&lt;P&gt;else count+1;&lt;/P&gt;
&lt;P&gt;if count &amp;lt;=200;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 17:51:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347480#M80278</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-05T17:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a number of variables by variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347508#M80286</link>
      <description>proc sql outobs=3;&lt;BR /&gt;create table want as&lt;BR /&gt;select * from have group by agent, priority;&lt;BR /&gt;quit;&lt;BR /&gt;proc print data=have;run;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Apr 2017 20:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347508#M80286</guid>
      <dc:creator>lakshmi_74</dc:creator>
      <dc:date>2017-04-05T20:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a number of variables by variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347509#M80287</link>
      <description>use outobs=200;</description>
      <pubDate>Wed, 05 Apr 2017 20:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347509#M80287</guid>
      <dc:creator>lakshmi_74</dc:creator>
      <dc:date>2017-04-05T20:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to select a number of variables by variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347516#M80289</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/69177"&gt;@lakshmi_74&lt;/a&gt; wrote:&lt;BR /&gt;proc sql outobs=3;&lt;BR /&gt;create table want as&lt;BR /&gt;select * from have group by agent, priority;&lt;BR /&gt;quit;&lt;BR /&gt;proc print data=have;run;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This would generate 200 total observations, not 200 per agent?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 21:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-select-a-number-of-variables-by-variable/m-p/347516#M80289</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-04-05T21:21:40Z</dc:date>
    </item>
  </channel>
</rss>

