Assignment 2
Assignment 2
Create a table from the employee_donations table with a new column that indicates the total
contributions from each employee.
a. Open the employee_donations SAS data set.
b. Write a SAS program to create a table named mgmt635.donations.
c. Create a new column named Total_Donations, which totals the values of the four quarterly
donations. Format the new column to display dollar signs, commas, and two decimal places.
Use a function to calculate the total, thereby ignore any missing values that might be in
the input columns.
d. Include the Employee_ID, Recipients, Paid_By, and Total_Donations columns in the new
table.
e. Run the program. Save the program in the SAS Code folder as Donations.sas.
Provide the screenshot of mgmt635.donations table.
3. Creating a Program to Calculate the Number of Years Employed (4 points)
Write a SAS program to create a table named years_at_work in the MGMT635 folder that includes
active employees (those with no termination date) and the number of years that each has been
employed until December 10, 2020.
a. Use the Employee_Payroll table as the input table. Include Employee_ID and
Employee_Hire_Date. Include only employees without a termination date.
b. Create a new column named Years_Employed that calculates the number of years that each
employee worked at Orion Star, based on the hire date and today's date. Apply a format that
displays the values rounded to one decimal place.
Hint: The function YRDIF(start-date, end-date, ‘actual’) computes the years. The end-date is a
date constant '10Dec2020'd
The format is 4.1.
c. Run the program and verify the results. Save the program to the SAS Code folder as
Howlong.sas. Provide the screenshot of the years_at_work table and use complete
sentences to describe the attributes of this table.
d. Use the Characterize Data task to investigate the distribution of Years_Employed in the
years_at_work table. Provide the screenshot of the results, i.e. descriptive statistics and
distribution of Years Employed. Write a few lines about the distribution of Years Employed.
Years _employed data from years_at_work data set has a mean of 28.54 with a standard
deviation of 11.92. The extreme values have the highest percentages. The data looks like an
inverse bell curve.
c. Format Employee_Hire_Date with the DDMMYY10. format so that dates appear as 20/10/2008.
d. Include only the Employee_ID, Salary, Employee_Hire_Date, and Salary_Range columns.
e. Run the program. Save the program in the SAS Code folder as SalaryRange.sas. Provide a
screenshot of table mgmt635.Salary_Range.
Deliverables:
Step 1: Include all your answers to problems 1 to 5 in a word document and turn-in the word document via Learn.
Please also insert the SAS codes you wrote, i.e. codes in Location.sas, Donations.sas, Howlong.sas,
Country_name.sas and SalaryRange.sas, into the same word document.
SAS Code
Location.sas
data payroll_location_1;
set mgmt635.payroll_location;
format salary dollarx10.2;
Bonus = salary * 0.02;
9