Scenario 2

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.stress1;                    /*#1*/
  set cert.stress;                    /*#2*/
  where RestHR <=70;                  /*#3*/
  TotalTime=(timemin*60)+timesec;     /*#4*/
  if TotalTime<600 then delete;       /*#5*/
run;
proc print data=work.stress1;         /*#6*
run;
1 The DATA step creates a new, temporary data set named, Work.Stress1.
2 The SET statement specifies the SAS data set that you want to read from. To create Work.Stress1, you read from Cert.Stress.
3 The WHERE statement selects only the observations where the values of RestHR are greater than or equal to 70.
4 The assignment statement creates the TotalTime variable by multiplying the value of TimeMin by 60 and adding the value of TimeSec. The values of TotalTime are assigned to each observation.
5 The IF-THEN and DELETE statements subset the data by omitting observations that have a TotalTime variable value less than 600.
6 The PROC PRINT step enables you to view the contents of the new data set, Work.Stress1.
Output A2.2 PROC PRINT Output of Work.Stress1
Here is the PROC PRINT output of the data set, Work.Stress1.

Test Your Code Solution

  1. Correct Answer: 6
  2. Correct Answer: 1055
If your answers are not correct, verify that you omitted the observations from the Work.Stress1 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