Hi All,
I want to use the observations of the previous month (the value of each observation is the same for a particular month) for the current month for each co_code. But for each co_code, the number of observations each month is not the same.
Here is an example of my dataset:
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long co_code float(date2 cal_year month bse_avg_daily_firm_weight)
11 17811 2008 10 2.490623e-08
11 17812 2008 10 2.490623e-08
11 17813 2008 10 2.490623e-08
11 17815 2008 10 2.490623e-08
11 17818 2008 10 2.490623e-08
11 17819 2008 10 2.490623e-08
11 17820 2008 10 2.490623e-08
11 17821 2008 10 2.490623e-08
11 17822 2008 10 2.490623e-08
11 17825 2008 10 2.490623e-08
11 17826 2008 10 2.490623e-08
11 17827 2008 10 2.490623e-08
11 17828 2008 10 2.490623e-08
11 17829 2008 10 2.490623e-08
11 17832 2008 10 2.490623e-08
11 17833 2008 10 2.490623e-08
11 17834 2008 10 2.490623e-08
11 17836 2008 10 2.490623e-08
11 17839 2008 11 2.778235e-08
11 17840 2008 11 2.778235e-08
11 17841 2008 11 2.778235e-08
11 17842 2008 11 2.778235e-08
11 17843 2008 11 2.778235e-08
11 17846 2008 11 2.778235e-08
11 17847 2008 11 2.778235e-08
11 17848 2008 11 2.778235e-08
11 17850 2008 11 2.778235e-08
11 17853 2008 11 2.778235e-08
11 17854 2008 11 2.778235e-08
11 17855 2008 11 2.778235e-08
11 17856 2008 11 2.778235e-08
11 17857 2008 11 2.778235e-08
11 17860 2008 11 2.778235e-08
11 17861 2008 11 2.778235e-08
11 17862 2008 11 2.778235e-08
11 17864 2008 11 2.778235e-08
I want to use the bse_avg_daily_firm_weight of month 10th for each observation in month 11th and so on. But the number of observations each month is different
Kindly, help with the code
I want to use the observations of the previous month (the value of each observation is the same for a particular month) for the current month for each co_code. But for each co_code, the number of observations each month is not the same.
Here is an example of my dataset:
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input long co_code float(date2 cal_year month bse_avg_daily_firm_weight)
11 17811 2008 10 2.490623e-08
11 17812 2008 10 2.490623e-08
11 17813 2008 10 2.490623e-08
11 17815 2008 10 2.490623e-08
11 17818 2008 10 2.490623e-08
11 17819 2008 10 2.490623e-08
11 17820 2008 10 2.490623e-08
11 17821 2008 10 2.490623e-08
11 17822 2008 10 2.490623e-08
11 17825 2008 10 2.490623e-08
11 17826 2008 10 2.490623e-08
11 17827 2008 10 2.490623e-08
11 17828 2008 10 2.490623e-08
11 17829 2008 10 2.490623e-08
11 17832 2008 10 2.490623e-08
11 17833 2008 10 2.490623e-08
11 17834 2008 10 2.490623e-08
11 17836 2008 10 2.490623e-08
11 17839 2008 11 2.778235e-08
11 17840 2008 11 2.778235e-08
11 17841 2008 11 2.778235e-08
11 17842 2008 11 2.778235e-08
11 17843 2008 11 2.778235e-08
11 17846 2008 11 2.778235e-08
11 17847 2008 11 2.778235e-08
11 17848 2008 11 2.778235e-08
11 17850 2008 11 2.778235e-08
11 17853 2008 11 2.778235e-08
11 17854 2008 11 2.778235e-08
11 17855 2008 11 2.778235e-08
11 17856 2008 11 2.778235e-08
11 17857 2008 11 2.778235e-08
11 17860 2008 11 2.778235e-08
11 17861 2008 11 2.778235e-08
11 17862 2008 11 2.778235e-08
11 17864 2008 11 2.778235e-08
I want to use the bse_avg_daily_firm_weight of month 10th for each observation in month 11th and so on. But the number of observations each month is different
Kindly, help with the code

Comment