Scenario 3

Code Solution

The solution listed below is one example of a program that could be used to accomplish each task within each scenario. Your code can be different, so long as it results in the same answers.
data work.staffreports;              /*#1*/
  set cert.staff;                    /*#2*/
  where WageCategory ne'H';          /*#3*/
  format DOB mmddyy10.;              /*#4*/
  Raise=WageRate*0.03;               /*#5*/
run;
proc print data=work.staffreports;   /*#6*/
  sum Raise;                         /*#7*/
run;
1 The DATA step creates a new data set named Work.Staffreports.
2 The SET statement specifies the SAS data set that you want to read from. To create Work.Staffreports, you read from Cert.Staff.
3 The WHERE statement selects only the observations for the values of WageCategory that do not equal H.
4 The FORMAT statement formats the DOB variable in the mmddyy10. format.
5 The assignment statement creates the Raise variable. The values for Raise are assigned for each observation by multiplying the value of WageRate by 3%.
6 The PROC PRINT step enables you to view the contents of the new data set, Work.Staffreports.
7 The SUM statement generates a grand total for the Raise variable.
Output A2.3 PROC PRINT Output of Work.Staffreports
Here is the PROC PRINT output of the data set, Work.Staffreports.

Test Your Code Solution

  1. Correct Answer: 07/17/1951
  2. Correct Answer: 177.32
  3. Correct Answer: 2024.05
If your answers are not correct, verify that you have observations from the Work.Staffreports data set.
Last updated: February 14, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset