So basically I'm not really "professional" sort of say in STATA but I have to work with it in my Thesis at the moment. I started by getting annual variables from compustat and then i stumbled upon standard deviation. I tried inputting monthly data on a different sheet and some how match or code through it, but im simply into skilled enough in STATA to do this. This could be done through a loop or something similar! To be more specific:
Year ID Variables.....
1 1
2 1
3 1
1 2
2 2
3 2
etc......
This "kind off" represents my first data set.
Month ID Returns
1 1
2 1
3 1
1 2
2 2
3 2
etc......
This represents my second data set....
Note that of course, most firms will have monthly data, which means 12 data points for each year. Now I have two problems, first of all from compustat, some firms just simply "die" at month 5 for example and then if I do an if function, this will ruin my data. So i want a way to simply compute from month 1 till month 5 (in my example) for each year. My second concern is how after that I could match each data point of the standard deviation to the first annual set. Note Ofcourse the ID is the same but with different frequency (yearly and monthly). Also, note my Month, is actually not month in a way, it's 1 2 3 4 but more of how stata downloads it for example "31jan2010". I'm not sure if this is a problem but it's something i felt like noting!
I'm really unsure how to achieve such a feet in STATA and I wouldn't mind sending my data if you'd like to view it. If you could give me the codes how to achieve this if it's not much work for you, it would help my research a lot!
One final remark, is that in the second "monthly" data, I might have different firms (less or more) for example i could have 1 1 1 1 then 3 3 3 3 where it skips, firm 2 without having (ill add that as missing data or might just drop it) but yeah mainly I want to match both.
Thank you for taking the time to read through my post
!
Regards,
Year ID Variables.....
1 1
2 1
3 1
1 2
2 2
3 2
etc......
This "kind off" represents my first data set.
Month ID Returns
1 1
2 1
3 1
1 2
2 2
3 2
etc......
This represents my second data set....
Note that of course, most firms will have monthly data, which means 12 data points for each year. Now I have two problems, first of all from compustat, some firms just simply "die" at month 5 for example and then if I do an if function, this will ruin my data. So i want a way to simply compute from month 1 till month 5 (in my example) for each year. My second concern is how after that I could match each data point of the standard deviation to the first annual set. Note Ofcourse the ID is the same but with different frequency (yearly and monthly). Also, note my Month, is actually not month in a way, it's 1 2 3 4 but more of how stata downloads it for example "31jan2010". I'm not sure if this is a problem but it's something i felt like noting!
I'm really unsure how to achieve such a feet in STATA and I wouldn't mind sending my data if you'd like to view it. If you could give me the codes how to achieve this if it's not much work for you, it would help my research a lot!
One final remark, is that in the second "monthly" data, I might have different firms (less or more) for example i could have 1 1 1 1 then 3 3 3 3 where it skips, firm 2 without having (ill add that as missing data or might just drop it) but yeah mainly I want to match both.
Thank you for taking the time to read through my post

Regards,
Comment