原题:
2. We have data for thetransaction history (in ascending order of date) of bank account. The bank account number is given in the firstdata line. The date in the second dataline is the date when the account is opened (it is 05JAN2008 in the following sample data).
001-9878-652817-2
05JAN2008 5,000
02JAN2009 7,500
11NOV2009-5,100
08FEB2010 -950
20MAR2011 4,500
16JAN2012-2,770
09JUN2012 -670
25FEB201312,500
Write one DATA step toread the above data and generate the following report in the Output window. Interest is computed using the formula
Interest = last balance*((1.000005)**(no. of days)-1)
The output format forwithdrawal, deposit, interest and balance is dollar12.2. Thedate showed after “Generated on” is the date you run the program.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
Reportfor account 001-9878-652817-2
(Generated on March 27, 2013)
Date Withdrawal Deposit Interest Balance
------------------------------------------------------------------
05JAN2008 $5,000.00
02JAN2009 $7,500.00 $9.08 $12,509.08
11NOV2009 $5,100.00 $19.59 $7,428.68
08FEB2010 $950.00 $3.31 $6,481.98
20MAR2011 $4,500.00 $13.14 $10,995.12
16JAN2012 $2,770.00 $16.62 $8,241.74
09JUN2012 $670.00 $5.98 $7,577.71
25FEB2013 $12,500.00 $9.90 $20,087.61
Use the following ruler to readthe column number of the above output.
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
(Hint: Thefirst two data lines should be handled differently from the others. One method to do so is presented below:
Read first record;
<some SAS statements>
Read second record;
<some SAS statements>
DO WHILE (1);
Read next record;
<some SAS statements>
END;
SAS will terminate when all data lines are read. )