<?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 Employees Earning More Than Their Managers in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494343#M72315</link>
    <description>&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Employee&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Given the&amp;nbsp;&lt;CODE&gt;Employee&lt;/CODE&gt;&amp;nbsp;table, write&amp;nbsp;data step that finds out employees who earn more than their managers. For the above table, Joe is the only employee who earns more than his manager.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data detail;

   input id $6

         name $8.

         salary 

         ManagerId $;
 

   datalines;
  1  Joe   70000 3   
  2  Henry 80000 4   
  3  Sam   60000 .
  4  Max   90000 .
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 10 Sep 2018 23:49:50 GMT</pubDate>
    <dc:creator>Geo-</dc:creator>
    <dc:date>2018-09-10T23:49:50Z</dc:date>
    <item>
      <title>Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494343#M72315</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Employee&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Given the&amp;nbsp;&lt;CODE&gt;Employee&lt;/CODE&gt;&amp;nbsp;table, write&amp;nbsp;data step that finds out employees who earn more than their managers. For the above table, Joe is the only employee who earns more than his manager.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data detail;

   input id $6

         name $8.

         salary 

         ManagerId $;
 

   datalines;
  1  Joe   70000 3   
  2  Henry 80000 4   
  3  Sam   60000 .
  4  Max   90000 .
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Sep 2018 23:49:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494343#M72315</guid>
      <dc:creator>Geo-</dc:creator>
      <dc:date>2018-09-10T23:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494346#M72316</link>
      <description>&lt;P&gt;See if this gets you started. Your data step as posted does not generate the data you think it does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data detail;
   input id : $6.
         name :$8.
         salary 
         ManagerId $
;
datalines;
1  Joe   70000 3   
2  Henry 80000 4   
3  Sam   60000 .
4  Max   90000 .
;
run;

proc sql;
   create table want as
   select a.name as employee, b.name as manager, a.salary as empsal, b.salary as managersalary
   from detail as a
        left join
        detail as b
        on a.managerid = b.id;
quit;

&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Sep 2018 00:05:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494346#M72316</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-11T00:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494362#M72317</link>
      <description>&lt;P&gt;What part of the question don't you understand that you need help with? There's a SQL solution above, but the instructions mention data step, so why a data step?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The steps are the same:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Merge data with itself&lt;/P&gt;
&lt;P&gt;In a data step, you need to rename the variables that are not key ID variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Flag if Manager is greater than Employee.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 02:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494362#M72317</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-11T02:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494399#M72318</link>
      <description>yes..data step is a must..would you mind tell me the exact code?thanks</description>
      <pubDate>Tue, 11 Sep 2018 06:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494399#M72318</guid>
      <dc:creator>Geo-</dc:creator>
      <dc:date>2018-09-11T06:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494495#M72320</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184018"&gt;@Geo-&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;yes..data step is a must..would you mind tell me the exact code?thanks&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why data step?&lt;/P&gt;
&lt;P&gt;If this is homework then what have you tried?&lt;/P&gt;
&lt;P&gt;If it is not homework why do you want what will be a more complicated solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 14:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494495#M72320</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-11T14:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494672#M72327</link>
      <description>just some practice that have to be done but means little from the way of using data step.BTW,your sql is wrong in this situation</description>
      <pubDate>Tue, 11 Sep 2018 23:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494672#M72327</guid>
      <dc:creator>Geo-</dc:creator>
      <dc:date>2018-09-11T23:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Employees Earning More Than Their Managers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494690#M72328</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184018"&gt;@Geo-&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;just some practice that have to be done but means little from the way of using data step.BTW,your sql is wrong in this situation&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SQL isn't wrong, but it's not the full answer to your question, intentionally.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two steps to this problem, a merge and a filter (WHERE/IF) operation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which step do you not know how to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the video tutorials below for each topic:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Merge data:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://video.sas.com/detail/video/4572997800001/merging-sas-tables-in-a-data-step" target="_blank"&gt;https://video.sas.com/detail/video/4572997800001/merging-sas-tables-in-a-data-step&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Filter data:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://video.sas.com/detail/video/4573016761001/filtering-a-sas-table-in-a-data-step" target="_blank"&gt;https://video.sas.com/detail/video/4573016761001/filtering-a-sas-table-in-a-data-step&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have issues after reviewing these videos (6 minutes roughly in total) post the code you've tried and&amp;nbsp;the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184018"&gt;@Geo-&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;just some practice that have to be done but means little from the way of using data step.BTW,your sql is wrong in this situation&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 02:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Employees-Earning-More-Than-Their-Managers/m-p/494690#M72328</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-12T02:13:51Z</dc:date>
    </item>
  </channel>
</rss>

