Hello, I am new to this forum.
I have a panel data of CRSP monthly stock returns since 1959. (the cross section variable is firm id and the time variable is month-year). the panel is then merged with the yearly tape of Cmpustat financial statement data. In order to merge the two panels I take each firm's fiscal year end month in the Compustat into account and generate a month-year variable based on it (in addition to the firm-id) I merge the Compustat and CRSP datasets. I need to calculate four-year-interval stock returns for non-overlapping firm-observations. I try to explain the overlapping issue in the merged panel:
I am currently using the command:
bysort id: generate return= ((1+ret)*(1+F.ret)*.......*(1+F47.ret))-1
after assigning my panel variables by xtset command(xtset id monthyear) in CRSP.
Then I merge this data with Compustat with 1:1 command using id and monthyear as identifying variables.
Assume that firm-id 100 appears in my panel every year from 1960 to 1967. Now If I start counting the monthly returns from the beginning of 1960, 48 months, the years 1960, 1961, 1962, and 1963 will be considered. Then STATA goes to the next firm-year which is firm-id 100 in year 1961. This time years 1961, 1962, 1963, and 1964 will be counted. So you see that there is an overlap for years 1961 to 1963 that are used to compute stock returns for two firm-year observations.
I want the computation to to begin for firm-id 100 in the beginning of 1960 and once the four-year stock return is computed I want to skip the firm-id 100 in years 1961 to 1963 and the next round of counting for this individual firm should begin in the year 1964.
The command is obviously not addequate to do the analysis that I want.
I would appreciate your help.
I have a panel data of CRSP monthly stock returns since 1959. (the cross section variable is firm id and the time variable is month-year). the panel is then merged with the yearly tape of Cmpustat financial statement data. In order to merge the two panels I take each firm's fiscal year end month in the Compustat into account and generate a month-year variable based on it (in addition to the firm-id) I merge the Compustat and CRSP datasets. I need to calculate four-year-interval stock returns for non-overlapping firm-observations. I try to explain the overlapping issue in the merged panel:
I am currently using the command:
bysort id: generate return= ((1+ret)*(1+F.ret)*.......*(1+F47.ret))-1
after assigning my panel variables by xtset command(xtset id monthyear) in CRSP.
Then I merge this data with Compustat with 1:1 command using id and monthyear as identifying variables.
Assume that firm-id 100 appears in my panel every year from 1960 to 1967. Now If I start counting the monthly returns from the beginning of 1960, 48 months, the years 1960, 1961, 1962, and 1963 will be considered. Then STATA goes to the next firm-year which is firm-id 100 in year 1961. This time years 1961, 1962, 1963, and 1964 will be counted. So you see that there is an overlap for years 1961 to 1963 that are used to compute stock returns for two firm-year observations.
I want the computation to to begin for firm-id 100 in the beginning of 1960 and once the four-year stock return is computed I want to skip the firm-id 100 in years 1961 to 1963 and the next round of counting for this individual firm should begin in the year 1964.
The command is obviously not addequate to do the analysis that I want.
I would appreciate your help.
Comment