<?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: Same salary in emp table using Datastep in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Same-salary-in-emp-table-using-Datastep/m-p/731104#M227734</link>
    <description>&lt;P&gt;The great thing is that you've got both SQL and the SAS data step which gives you a choice.&lt;/P&gt;
&lt;P&gt;For the data step to work the data needs to be sorted by salary.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=emp;
  by salary;
run;

data want;
  set emp;
  by salary;
  if not (first.salary and last.salary);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Apr 2021 06:18:07 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-04-03T06:18:07Z</dc:date>
    <item>
      <title>Same salary in emp table using Datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-salary-in-emp-table-using-Datastep/m-p/731102#M227732</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data emp;
input Name$ Station Salary;
datalines;
Bob    1      2000  
Steve  2      1750  
Mark   3      2050  
Lisa   4      2200  
Hans   5      2000  
;
run;



proc sql;
select * from emp e1, emp e2
where e1.Salary =e2.Salary and e1.name ne e2.name	;
quit;

/*OR*/
proc sql;
select * from emp 
where salary in (select salary from emp group by salary 
                 having count(*)&amp;gt;1);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Get same salary using Datastep&lt;/P&gt;</description>
      <pubDate>Sat, 03 Apr 2021 05:51:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-salary-in-emp-table-using-Datastep/m-p/731102#M227732</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2021-04-03T05:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Same salary in emp table using Datastep</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-salary-in-emp-table-using-Datastep/m-p/731104#M227734</link>
      <description>&lt;P&gt;The great thing is that you've got both SQL and the SAS data step which gives you a choice.&lt;/P&gt;
&lt;P&gt;For the data step to work the data needs to be sorted by salary.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=emp;
  by salary;
run;

data want;
  set emp;
  by salary;
  if not (first.salary and last.salary);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Apr 2021 06:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-salary-in-emp-table-using-Datastep/m-p/731104#M227734</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-04-03T06:18:07Z</dc:date>
    </item>
  </channel>
</rss>

