Hi, I have a 3 dimensional panel: country, firm, date. I use xtset countryfirm date. and I want to cluster by country date. I get error message that "panels are not nested within clusters". I have attached a subset of the data with 2 firms per country with 12 months each, and 2 countries. The original data has 52 countries, varying numbers of firms (from low teens, to thousands), and 15 years of monthly data. I can't figure out what I've done wrong. I'm using the command: xtreg mktrf climateresid i.country, vce(cluster country date). Thanks.

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input long country float(date countryfirm mktrf) double climateresid
1 540  1 -2.76                    .
1 541  1  1.89   -.5187058035931387
1 542  1 -1.97    .3266362390933121
1 543  1 -2.61   -.3461968642854406
1 544  1  3.65    .0954452596125687
1 545  1   .57    .2886939441208527
1 546  1  3.92  -.09544542329737962
1 547  1 -1.22     .327815105554067
1 548  1   .49  -.21045129388480227
1 549  1 -2.02 -.057502935293711324
1 550  1  3.61   .23119086027145386
1 551  1  -.25  -.01838169912672885
1 540  2 -2.76                    .
1 541  2  1.89   -.5187058035931387
1 542  2 -1.97    .3266362390933121
1 543  2 -2.61   -.3461968642854406
1 544  2  3.65    .0954452596125687
1 545  2   .57    .2886939441208527
1 546  2  3.92  -.09544542329737962
1 547  2 -1.22     .327815105554067
1 548  2   .49  -.21045129388480227
1 549  2 -2.02 -.057502935293711324
1 550  2  3.61   .23119086027145386
1 551  2  -.25  -.01838169912672885
2 540 51 -2.76                    .
2 541 51  1.89   -.5187058035931387
2 542 51 -1.97    .3266362390933121
2 543 51 -2.61   -.3461968642854406
2 544 51  3.65    .0954452596125687
2 545 51   .57    .2886939441208527
2 546 51  3.92  -.09544542329737962
2 547 51 -1.22     .327815105554067
2 548 51   .49  -.21045129388480227
2 549 51 -2.02 -.057502935293711324
2 550 51  3.61   .23119086027145386
2 551 51  -.25  -.01838169912672885
2 540 52 -2.76                    .
2 541 52  1.89   -.5187058035931387
2 542 52 -1.97    .3266362390933121
2 543 52 -2.61   -.3461968642854406
2 544 52  3.65    .0954452596125687
2 545 52   .57    .2886939441208527
2 546 52  3.92  -.09544542329737962
2 547 52 -1.22     .327815105554067
2 548 52   .49  -.21045129388480227
2 549 52 -2.02 -.057502935293711324
2 550 52  3.61   .23119086027145386
2 551 52  -.25  -.01838169912672885
end
format %tm date
label values country country
label def country 1 "Argentina", modify
label def country 2 "Australia", modify