Scenario 6

Code Solution

The solution listed below is one example of a program that could be used to accomplish each task within the scenario. Your code can be different, as long as it results in the same answers.
libname certdata XLSX 'C:\Users\certdata\heart.xlsx';                 /*#1*/
data work.heart;                                                      /*#2*/
   set certdata.heart(drop=AgeAtDeath DeathCause);                    /*#3*/
   where Status='Alive';                                              /*#4*/
   if AgeCHDdiag=. then delete;                                       /*#5*/
   length Smoking_Status $17;                                         /*#6*/
   if 0<=Smoking<6 then Smoking_Status='Non-Smoker (0-5)';            /*#7*/
   else if 6<=Smoking<=15 then Smoking_Status='Moderate (6-15)';
   else if 16<=Smoking<=25 then Smoking_Status='Heavy (16-25)';
   else if Smoking>25 then Smoking_Status='Very Heavy (> 25)';
   else Smoking_Status='Error';                                       /*#8*/ run; proc freq ...

Get SAS Certified Specialist Prep Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.