Reading Date and Time Values | |
Using Dates and Times in
Calculations |
The value for RoomCharge is calculated next. RoomCharge
is the product of Days and RoomRate .
options yearcutoff=1920; data perm.aprbills; infile aprdata; input lastname $8. @10 DateIn mmddyy8. +1 DateOut mmddyy8. +1 RoomRate 6. @35 equipcost 6.; Days=dateout-datein+1; RoomCharge=days*roomrate; Total=roomcharge+equipcost; run; |
Raw Data File Aprdata
1---+----10---+----20---+----30---+----40 |
Akron 04/05/99 04/09/99 175.00 298.45 |
Brown 04/12/99 05/01/99 125.00 326.78 |
Carnes 04/27/99 04/29/99 125.00 174.24 |
Denison 04/11/99 04/12/99 175.00 87.41 |
Fields 04/15/99 04/22/99 175.00 378.96 |
Jamison 04/16/99 04/23/99 125.00 346.28 |
The value for Total is the final calculation. Total
is the sum of EquipCost and RoomCharge .
options yearcutoff=1920; data perm.aprbills; infile aprdata; input LastName $8. @10 DateIn mmddyy8. +1 DateOut mmddyy8. +1 RoomRate 6. @35 EquipCost 6.; Days=dateout-datein+1; RoomCharge=days*roomrate; Total=roomcharge+equipcost; run; |
Raw Data File Aprdata
1---+----10---+----20---+----30---+----40 |
Akron 04/05/99 04/09/99 175.00 298.45 |
Brown 04/12/99 05/01/99 125.00 326.78 |
Carnes 04/27/99 04/29/99 125.00 174.24 |
Denison 04/11/99 04/12/99 175.00 87.41 |
Fields 04/15/99 04/22/99 175.00 378.96 |
Jamison 04/16/99 04/23/99 125.00 346.28 |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.