libname mylib '/folders/myfolders/'; proc import datafile= '/folders/myfolders/Files/DataSet1.xlsx' out= mylib.outdata dbms= xlsx replace; sheet= "Employee-Attrition"; run; Question 1: Answer : LifeScience proc sort data=mylib.outdata out=mylib.outdata1; by EducationField; data totalby (keep= EducationField total); set mylib.outdata1; by EducationField; if First.EducationField then Total = 0; Total + DailyRate; if last.EducationField; run; proc sort data=totalby out=mylib.totalbysorted; by total; proc sql; create table totalsql as select EducationField, sum(DailyRate) as DailyRateTotal from mylib.outdata group by EducationField order by DailyRateTotal desc; quit; Question2 : Answer : LifeScience 3 proc sql; create table totalsql2 as select x.EducationField,x.Education,x.DailyRateTotal from ( select EducationField, max(DailyRateTotal) as MaxDailyrate from ( select EducationField, Education, sum(DailyRate) as DailyRateTotal from mylib.outdata group by EducationField, Education) group by EducationField) as y inner join ( select EducationField, Education, sum(DailyRate) as DailyRateTotal from mylib.outdata group by EducationField, Education) as x on x.EducationField=y.EducationField and x.DailyRateTotal=y.MaxDailyrate ; quit; Question 3: Answer : 25-34 proc format; value Agerange Low-25="Less Than 25" 25-34 ='25 to 34' 35-41='35 to 41' 42-50= '42 to 50' 51-High='High'; run; proc freq data = mylib.outdata ; table age * Attrition; format age agerange.; run; proc sql; create table mylib.Attrition as select case when age <25 then 'Under 25' when age between 25 and 34 then '25-34' when age between 35 and 41 then '35-41' when age between 42 and 50 then '42-50' when age > 51 then 'Above 50' END as age_range, count (attrition) as attritioncount from mylib.outdata group by age_range; quit; Question 4: Answer: Above 50 proc sql; create table mylib.Attrition as select case when age <25 then 'Under 25' when age between 25 and 34 then '25-34' when age between 35 and 41 then '35-41' when age between 42 and 50 then '42-50' when age > 51 then 'Above 50' END as age_range,BusinessTravel, count (BusinessTravel) as BusinessTravelcount from mylib.outdata where BusinessTravel='Non-Travel' group by age_range,BusinessTravel; quit;