Hello all,

I want to find the new sale price for each year represented through new_sales. I will use the sale price in 2000q4 as the baseline (100). For example, year=2001q1 should be calculated by: new_sales=0.08*100=8+100=108. Then, I want to use this calculated new_sales value (108) to calculate new_sales for 2001q2. Then, find the new_sales value in 2001q3 by using the value in 2001q2 and so on.

I have many different new_sales columns that need to be calculated given different scenarios, so I think some sort of loop would work best.

Here is an example of my data:

Code:

input str7 year float(sales_percent new_sales)
2000q4 0.01 100
2001q1 0.08
2001q2 0.06
2001q3 0.07
2001q4 0.001
2002q1 0.02
2002q2 0.02
2002q3 0.03
2002q4 0.05
2003q1 0.02
2003q2 0.03
2003q3 0.001
2003q4 0.01
I would appreciate any assistance with this!

Thanks,
Anoush K.