Date: Fri, 14 Jan 2011 12:02:01 -0800
Reply-To: Tanmoy Mukherjee <tkmcornell@yahoo.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tanmoy Mukherjee <tkmcornell@YAHOO.COM>
Subject: Forecasting data based on linkages
Content-Type: text/plain; charset=us-ascii
I have a list of loan_ids with some variables. This is the dataset for one month of data, now I want to create a forecasted database of the loans by advancing the date one month and doing some computations on the loan data. When I am running one loan at a time I am not getting any errors but when I run the loan_ids in a batch then I start getting the errors.
The code I am wiritng is as follows :
data historic (keep= loan_nid Dist_Date age balance geo_region index_orig geo_code);
retain loan_nid Dist_Date age balance;
set mylib.historic;
format Dist_Date mmddyy10.;
/* if loan_id NE 567888 then delete;*/
run;
data transition (keep=age C2P);
retain age C2P;
run;
data rates (keep= Dist_Date geo_region int_rate index_curr);
retain Dist_Date geo_region int_rate index_curr;
run;
proc sql;
create index geo_region_Dist_Date on rates(geo_code, Dist_Date);
create index age on transition(age);
run;
data forecast;
set historic;
fcstperiod=16;
ibal=balance;
do maxrun=0 to fcstperiod;
if maxrun=0 then i=0;
ELSE i=1;
beg_bal=ibal;
age=age+i;
Dist_Date=intnx('month',Dist_Date,i);
format Dist_Date mmddyy10.;
seasonality=month(Dist_Date);
set transition key=age;
set rates key=geo_region_Dist_Date;
hpa=(index_curr/index_orig-1)*100;
end_bal=beg_bal*(1+int_rate/1200)+100;
ibal=end_bal;
output;
end;
run;
I will appreciate if someone can point out the error in the data.
Tanmoy Kumar Mukherjee
3 Perrine Court,
East Brunswick, NJ 08816
Phone: 9173994540
Email: tkmcornell@yahoo.com