09-25-2013 04:39 PM
Hi, I am trying to calculate a varible in SAS which is dependant on the previously calculated varibles. I thought this would be simple with the following code but it does not compute.
if id_perd = '1' then Dis_fact= 1/(1+((Swap_Spot_Rate)/12));
else if id_perd > '1' then Dis_fact = (1/(1+((Swap_Spot_Rate)/12)))*lag(Dis_fact);
Is it possible to calculate a varible dependant on the previously calculated varible in sas? All help would be appreciate. Thanks! Patrick B.
09-25-2013 04:49 PM
It should be as easy as 1 2 3.
First, make sure that RATE does not already contain a variable named DIS_FACT.
Second, get rid of the LAG function entirely.
Third, add this statement to the DATA step:
That should do it.