Hello,

I am pretty new user of Stata. I would like to create new variables by using the subset of an existing variable. I have the values of the first 5 columns of the table stated below. I want to create the last three columns.
Analyst A released her forecasts for EPS1, EPS2, and EPS3 on March 2014. We can see these values at the fifth column. I would like to create the last three new columns by matching the name of analyst from the first column and also check Date of forecasting and forecast date. It seems a bit confusing for me.

Thanks in advance for your help.

Volkan
Analyst FPI Forecast Date Date of forecasting Forecasted Value (EPS) EPS1 (forecast for year 1 end) EPS2 (forecast for year 2 end) EPS3 (forecast for year 3 end)
A 1 2014 December March 2014 1.73 (it is EPS1 since FPI=1) 1.73 1.89 2.25
A 2 2015 December March 2014 1.89 (EPS2 it is EPS2 since FPI=2)
A 3 2016 December March 2014 2.25 (EPS3)
B 1 2014 December April
2014
1.85 1.85