Question
A: hikingGear.sas program: 1) Using the supplied hikingGear.sas create the work.hikingGear data set. This code is shown below: data work.hikingGear; input Supplier $ 1-20 Country
A: hikingGear.sas program: 1) Using the supplied hikingGear.sas create the work.hikingGear data set. This code is shown below: data work.hikingGear; input Supplier $ 1-20 Country $ 23-24 Product $ 28-70; datalines; Top Sports DK Black/Black Top Sports DK X-Large Bottlegreen/Black Top Sports DK Comanche Women's 6000 Q Backpack. Bark Miller Trading Inc US Expedition Camp Duffle Medium Backpack Toto Outdoor Gear AU Feelgood 75 Litre Black Women's Backpack Toto Outdoor Gear AU Jaguar 65 Liter Blue Women's Backpack Top Sports DK Medium Black/Bark Backpack Top Sports DK Medium Gold Black/Gold Backpack Top Sports DK Medium Olive Olive/Black Backpack Toto Outdoor Gear AU Trekker 65 Royal Men's Backpack Top Sports DK Victor Grey/Olive Women's Backpack Luna sastreria S.A. ES Hammock Sports Bag Miller Trading Inc US Sioux Men's Backpack 26 Litre. ; run; proc contents data = work.hikingGear; run; proc print data = work.hikingGear; run; 2) (6 pts) Add a new proc freq procedure to the hikingGear.sas program that displays the count of the products supplied from each of the countries, that is, how many different products does each country have in this data set. Display only the count and percentage; do not display cumulative statistics. 3) (12 pts) The online Orion store is creating a catalog which will segregate its hiking gear by gender. Add three new data steps to the hikingGear.sas program each one creating a new data set from work.hikingGear, containing an additional variable called Gender: a. Call the first new data set work.hikingGearW, and set Gender to 'Women'. Use a WHERE statement to subset the original data set to include only the observations that have 'Women' as part of the Product name. The new data set should have only three variables; drop the Country variable. b. Call the second new data set work.hikingGearM, and set Gender to 'Men'. Use a WHERE statement to subset the original data set to include only the observations that have 'Men' as part of the Product name. The new data set should have only three variables; drop the Country variable. c. Call the third new data set work.hikingGearU, and set Gender to 'Unisex'. Use a WHERE statement to subset the original data set to include only the observations that do not occur in the work.hikingGearW or work.hikingGearM data sets. The new data set should have only three variables; drop the Country variable. 4) (8 pts) Verify that each of the original records occur only in one of the three new data sets (work.hikingGearU, work.hikingGearW, work.hikingGearM) using a proc print procedure on each new data set. Add these procedures to the hikingGear.sas program. 5) (8 pts) Concatenate these three new data sets (work.hikingGearU, work.hikingGearW, work.hikingGearM) into a new data set called work.hikingGearProd, so that the 'Unisex' records occur first, the 'Women' records occur next and the 'Men' records occur last. Add this data step to the hikingGear.sas program. 6) (6 pts) Create a new data set called work.hikingGearSup using a datalines statement group that reads in each Supplier and Country. There should be only four records in this new data set. Add this data step to the hikingGear.sas program. 7) (10 pts) Add appropriate proc sort procedures and one data step to the hikingGear.sas program that merges the two new data sets created above (work.hikingGearSup and work.hikingGearProd) by Supplier into a new data set called work.hikingGearSupProd. 8) (5 pts) Verify the correctness of the merge. Display both the descriptor and data contents of the new work.hikingGearSupProd data set. Add these two procedures to the hikingGear.sas program. B: salaryInfo.sas program: 1) (10 pts) Orion has a group of employees that have been singled out for a bonus. Create a SAS data set from the salaryInfo.dat raw data file containing information on these employees. Call the data set work.salaryInfo. Place the Data step into a SAS program called salaryInfo.sas. This file is included with the midterm files. Its contents is given below. However, you must read it in as a raw data file using an INFILE statement and an INPUT statement. Notice that the file does not have its fields lined up into specific columns. Give the data set the following variable names: Name, HireDate, Age, State, Salary. You will need to use informats to read in the date and salary information. Using date functions with HireDate, create two new variables, one called HireMonth containing the numerical month value and the other called HireQtr containing the quarter in which the month occurs. Add another variable called Bonus. An employees Bonus is based on a percentage of their Salary that is calculated in the following way: Multiply the quarter of the year in which the employee was hired (HireQtr) by their Age and divide by 2000. This will give you the percentage for the Bonus. Multiply this percentage by the employees Salary to get the Bonus. Example: Antonios bonus should be $1,522.51. Donny 5MAY2008 25 FL $43,132.50 Margaret 20FEB2008 43 NC $65,150.00 Dan 1JUN2008 27 FL $40,000.00 Subash 2FEB2008 45 NC $75,750.00 Antonio 25MAY2008 35 FL $43,500.40 Jose 1AUG2008 33 NC $65,150.00 Victor 5MAY2008 29 FL $33,250.50 Marianna 2OCT2008 53 NC $125,330.00 2) (3 pts) Display the descriptor portion of the new work.salaryInfo data set. Display the variables in creation order. Add this procedure to the salaryInfo.sas program. 3) (7 pts) Add a proc format procedure to the salaryInfo.sas program that creates two user-defined formats: a. an AgeGrp format which groups the Age variable as 20-29, 30-39, 40-49, and 50+. b. a MonthName format displays the HireMonth name using the three character abbreviation. Be sure to include all the names of the months. 4) (10 pts) Add a proc print procedure to the salaryInfo.sas program. It must produce a report from the work.salaryInfo data set with the following features: a. Use both the formats previously defined, replacing Age with its group and HireMonth with its name. b. Display the Salary with two decimal places and include commas and the dollar sign. Assume the Salary can be six figures. c. Display the Bonus with no decimal places and include commas and the dollar sign. d. Use SUM statement to total the all the salaries. e. Use a LABEL statement to display the Salary column as Annual Salary. f. Use an ID statement replacing the OBS column with the Name column. g. Do not display the HireDate column. 5) (10 pts) The Bonus will be added to the employees Salary on the last day of each quarter after their HireDate anniversary. Create a new data set from the work.salaryInfo data set called work.bonusInfo. Add a variable called TotalBonus, which is calculated by totaling up the Bonus for each employee, based on the quarter of the HireDate. For employees hired during the first quarter, their Bonus will be given four times; for employees hired during the second quarter, their Bonus will be given three times; for employees hired during the third quarter, their Bonus will be given twice; for employees hired during the last quarter, their Bonus will be given once. This data set keeps the following variables: Name, HireMonth, Salary, and TotalBonus. Add the data step to the salaryInfo.sas program. 5) (5 pts) Add a proc print procedure to the salaryInfo.sas program. It must produce a report from the work.bonusInfo data set with the following features: a. Use the format previously defined for HireMonth. b. Display the Salary with two decimal places and include commas and the dollar sign. Assume the Salary can be six figures. c. Display the TotalBonus with no decimal places and include commas and the dollar sign. d. Use a LABEL statement to display the Salary column as Annual Salary and the TotalBonus column as Total Bonus. e. Use an ID statement replacing the OBS column with the Name column.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started