<?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 SQL SAS Top % records in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758357#M80843</link>
    <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a table, how can I get the top 50% of records into one table and thereafter the bottom 50% of records in another table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I generally use PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please assist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jul 2021 10:43:09 GMT</pubDate>
    <dc:creator>Citrine10</dc:creator>
    <dc:date>2021-07-30T10:43:09Z</dc:date>
    <item>
      <title>SQL SAS Top % records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758357#M80843</link>
      <description>&lt;P&gt;Hi there&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a table, how can I get the top 50% of records into one table and thereafter the bottom 50% of records in another table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I generally use PROC SQL;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please assist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 10:43:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758357#M80843</guid>
      <dc:creator>Citrine10</dc:creator>
      <dc:date>2021-07-30T10:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SAS Top % records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758358#M80844</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
 if 0 then set sashelp.snacks nobs=count;
 call symputx('numobsDIV2'      ,put(int(count/2),8.  ));
 call symputx('numobsDIV2_plus1',put(int(count/2)+1,8.));
 STOP;
run;
%PUT &amp;amp;=numobsDIV2;
%PUT &amp;amp;=numobsDIV2_plus1;

PROC SQL noprint;
 create table work.First_50_pct as
 select *
 from sashelp.snacks(firstobs=1 obs=&amp;amp;numobsDIV2.);
 create table work.Last_50_pct as
 select *
 from sashelp.snacks(firstobs=&amp;amp;numobsDIV2_plus1. obs=MAX);
QUIT;
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 10:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758358#M80844</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-07-30T10:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SAS Top % records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758364#M80845</link>
      <description>&lt;P&gt;If you have SAS9.4 .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table top_50 as
select * from sashelp.class
 having weight&amp;gt;=median(weight);

create table bottom_50 as
select * from sashelp.class
 having weight&amp;lt;median(weight);

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 12:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758364#M80845</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-30T12:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: SQL SAS Top % records</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758437#M80846</link>
      <description>&lt;P&gt;How is "top 50%" defined?&lt;/P&gt;
&lt;P&gt;What about ties. Consider values such as&lt;/P&gt;
&lt;P&gt;ID value&lt;/P&gt;
&lt;P&gt;1&amp;nbsp;&amp;nbsp; 1&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;4&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;5&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;
&lt;P&gt;6&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is "50%"?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 16:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-SAS-Top-records/m-p/758437#M80846</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-07-30T16:55:15Z</dc:date>
    </item>
  </channel>
</rss>

