Hi,

I am working on my master thesis and I am currently busy with the data cleaning process. One of my independent variables is the annual stock return. Annual stock returns are to be calculated based on montly stock returns obtained from CRSP. As stock return data is not available every month for each firm, some studies require half of the yearly observations to be available, otherwise the firm year should be dropped. Therefore, I would like like to have a firm year level dropped if more than 6 months or more are missing (.). My data is structured as follows (note that FYPERMCO in an the identifier which is firm-year specific):

permno date permco ret fy FYPERMCO
12165 30nov2001 10043 .044108737 2001 89682
12165 31dec2001 10043 .037037145 2001 89682
12166 31oct1988 9999 . 1988 89354
12166 30nov1988 9999 . 1988 89354
12166 30dec1988 9999 0 1988 89354
12166 31jan1989 9999 -.047945205 1988 89354
12166 28feb1989 9999 -.007194245 1988 89354
12166 31mar1989 9999 -.021739131 1988 89354

Could somebody help me on this command? Help is highly appreciated. Thank you!