Hello everyone,
I would like to kindly ask how to solve my problem with Panel data using a rolling 60 month window. This is my sample data (there is unique crsp_portnos with average of 200 month of age)
input double(crsp_portno crsp_fundno) float(mofd portret)
1000001 4273 373 .123
1000001 4273 374 .124
1000001 4273 375 .125
1000001 4273 376 .126
1000001 4273 377 .127
1000001 4273 378 .128
1000001 4273 379 .129
1000001 4275 373 .123
1000001 4275 374 .124
1000001 4275 375 .125
1000001 4275 376 .126
1000001 4275 377 .127
1000001 4275 378 .128
1000001 4275 379 .129
end
[/CODE]
As you can see crsp_portno consists of different crsp_fundnos. Thus, in a certain month there could 1, 2 or more observations when a crsp_portno has 1, 2 or more crsp_fundnos in a certain month. Now, to run the xtreg command I need to overcome repeated time values within panel to use -xtset crsp_portno datecode. I run -egen datecode=group(mofd)- and then -rangestat (xtreg) portret mkt, interval(datecode -59 0) by(crsp_portno) excludeself- , but the information I receive back is <istmt>: 3499 xtreg() not found. I thought I could just run duplicates drop crsp_portno mofd, force, but with the line I lose observations that include some other information for unique crsp_fundno in certain month. Could you tell me how to overcome this problem? Could it be the reason that the data in unbalanced?
To overcome <istmt>: 3499 xtreg() not found, I have just uploaded STATA but nothing has changed, and xtreg is still not working
Best regards,
Rafał
I would like to kindly ask how to solve my problem with Panel data using a rolling 60 month window. This is my sample data (there is unique crsp_portnos with average of 200 month of age)
input double(crsp_portno crsp_fundno) float(mofd portret)
1000001 4273 373 .123
1000001 4273 374 .124
1000001 4273 375 .125
1000001 4273 376 .126
1000001 4273 377 .127
1000001 4273 378 .128
1000001 4273 379 .129
1000001 4275 373 .123
1000001 4275 374 .124
1000001 4275 375 .125
1000001 4275 376 .126
1000001 4275 377 .127
1000001 4275 378 .128
1000001 4275 379 .129
end
[/CODE]
As you can see crsp_portno consists of different crsp_fundnos. Thus, in a certain month there could 1, 2 or more observations when a crsp_portno has 1, 2 or more crsp_fundnos in a certain month. Now, to run the xtreg command I need to overcome repeated time values within panel to use -xtset crsp_portno datecode. I run -egen datecode=group(mofd)- and then -rangestat (xtreg) portret mkt, interval(datecode -59 0) by(crsp_portno) excludeself- , but the information I receive back is <istmt>: 3499 xtreg() not found. I thought I could just run duplicates drop crsp_portno mofd, force, but with the line I lose observations that include some other information for unique crsp_fundno in certain month. Could you tell me how to overcome this problem? Could it be the reason that the data in unbalanced?
To overcome <istmt>: 3499 xtreg() not found, I have just uploaded STATA but nothing has changed, and xtreg is still not working
Best regards,
Rafał

Comment