Open the ehs01 program
from the EHS folder and correct the errors in the program. For instructions,
see the commented code in the program that is marked by a slash (/)
and an asterisk (*).
Example Code 17.1 ehs01 Program: Fix the Errors
data work.aprilbills drop=Total, EquipCost; /*#1*/
set cert.aprbills;
if Days > 7 then Discount=(RoomCharge)*20% else 0; /*#2*/
TotalDue=Total-Discount; /*#3*/
format DateIn DateOut date9; /*#4*/
format RoomRate RoomCharge Discount TotalDue dollar10.; /*#5*/
proc print data=work.aprilbills; /*#6*/
Here are instructions that are commented in the program, ehs01.
1 |
Drop the variables Total and EquipCost. |
2 |
If the Days variable is greater
than 7, then Discount is the value of RoomCharge multiplied by 20
%. If the Days variable is less than or equal to 7, then Discount
is set to 0.
|
3 |
Create a new variable, TotalDue,
with a value of Total minus Discount.
|
4 |
Format DateIn and DateOut to appear
as 05APR2009.
|
5 |
Format the variables RoomRate,
RoomCharge, Discount, and TotalDue to appear as $100.00.
|
6 |
Print your results. |