@SuryaKiran Essentially, if you filter the Reference column for any employee ID, it will give each employee who reports through that Reference employee and the number of levels below that Reference employee each employee is. Maybe it'll help if I walk through a much shorter, specific example. Take these three employee-manager relationships: data WORK.HAVE;
infile datalines dsd truncover;
input Employee_ID:BEST. Manager_ID:BEST.;
datalines2;
11111,33333
22222,33333
33333,44444 For each Employee ID, a level 0 reference record is created. Next, the Manager ID column is searched for that reference ID. This will give any direct reports who are -1 levels from the reference. Then, each direct report's ID is searched in the manager ID column. This gives anyone who indirectly reports -2 levels from the reference. After the entire employee hierarchy that reports through the reference is exhausted, the program moves to the next employee to repeat the process. In the case above, this would be the output. Reference ID Levels from Reference ID Employee ID Manager ID 11111 0 11111 33333 22222 0 22222 33333 33333 0 33333 44444 33333 -1 11111 33333 33333 -1 22222 33333 Does that make more sense?
... View more