Hi all,
I have lat 4 year tuition fee laid out as Fee_YR_01-Fee_YR_04 and their corresponding increased rate Increase_YR_01-Increase_YR_04. I want 4 new rows which will calculate the tuition fee for the next 4 years based on their previous year tuitions and corresponding increase. But instead of calculating all 4 rows, I want the calculated output of the first row to be copied below all the way to the end.
I was able to do the calculation on the first row, but don't know how to copy downward. Can anyone help please. Thank you
data have;
input Fee_YR_01 Fee_YR_02 Fee_YR_03 Fee_YR_04 Increase_YR_01 Increase_YR_02 Increase_YR_03 Increase_YR_04;
datalines;
1000 1050 1100 1150 0 20 20 20
1000 1070 1100 1150 0 20 20 20
3000 3100 3150 3200 0 15 15 15
3000 3200 3200 3300 0 15 15 15
;
RUN;
DATA Want;
SET Have;
ARRAY Increase_Rate(*) Increase_YR_01 - Increase_YR_04;
ARRAY Fee_New(*) Fee_New_AY_01 - Fee_New_AY_04;
Fee_New_AY_01=Fee_YR_01;
DO i=2 TO dim(Fee_New);
IF _n_=1 THEN fee_new(i) = FLOOR(( fee_new(i-1) * (1+(Increase_Rate(i)/100)) )/10)*10;
END;
DROP i;
RUN;
Expected Output:
Fee_YR_01
Fee_YR_02
Fee_YR_03
Fee_YR_04
Increase_YR_01
Increase_YR_02
Increase_YR_03
Increase_YR_04
Fee_New_AY_01
Fee_New_AY_02
Fee_New_AY_03
Fee_New_AY_04
1000
1050
1100
1150
0
20
20
20
1000
1200
1440
1720
1000
1070
1100
1150
0
20
20
20
1000
1200
1440
1720
3000
3100
3150
3200
0
15
15
15
3000
1200
1440
1720
3000
3200
3200
3300
0
15
15
15
3000
1200
1440
1720
... View more