Piggyback Loans

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: loaex05.sas
 Description: Example program from SAS/ETS User's Guide,
              The LOAN Procedure
       Title: Piggyback Loans
     Product: SAS/ETS Software
        Keys: fixed rate, adjustable rate, buydown,
              and balloon payment loans
        PROC: LOAN
       Notes:

--------------------------------------------------------------*/

title1 'LOAN: Piggyback loan example';

title2 'LOAN: Conventional loan';

proc loan start=2002:1 noprint;

   fixed price=200000 dp=40000 rate=7.5 life=360
         label='20 percent down: Conventional Fixed Rate' ;

   compare at=(60 120 180) pwofcost taxrate=30 marr=12
           breakpay breakint outcomp=comploans;

run;

title2 'LOAN: Piggyback: Primary Loan';

proc loan start=2002:1 noprint;

   fixed amount=160000 dp=20000 rate=7.75 life=360
         label='Piggyback: Primary loan' out=loan1;

   compare at=(60 120 180 ) pwofcost taxrate=30 marr=12
          breakpay breakint outcomp=cloan1;

run;

title2 'LOAN: Piggyback: Secondary (Home Equity) Loan';

proc loan start=2002:1 noprint;

   fixed amount=20000  rate=8.25 life=180
         label='Piggyback: Secondary (Home Equity) Loan' out=loan2;

   compare at=(60 120 180 ) pwofcost taxrate=30 marr=12
           breakpay breakint  outcomp=cloan2;

run;

data cloan12;
   set cloan1  cloan2;
run;

proc timeseries data=cloan12 out= totcomp ;
   id date interval=year5.25 acc=total notsorted;
   var payment interest pwofcost balance ;
run;

/*-- LOAN: Piggyback loan --*/
title;
proc print data=totcomp;
   format date monyy7.;
run;

data comploans;
   set comploans;
   drop type label;
run;

/*-- LOAN: Conventional Loan --*/
title;
proc print data=comploans;
run;