Hello everybody,
I am trying to estimate this model using IV:
Y = B0 + B1D + B2X + U, with D endogenous dummy variable.
In my particular case, Y is the crime rate at the ZIP code level from 2011 to 2019; D is a time-invariant dummy that captures whether a ZIP code has been gentrified in the 2011-2019 period and X is a vector of ZIP code characteristics used as controls. To maximize the estimating power, I would retain annual observations for crime rate even though the gentrification indicator is based off of a single decadal change.

FollowingWooldridge(2002) and ( https://www.statalist.org/forums/for...nous-regressor ) I am willing to estimate D = A0 + A1Z + A2X + V using a probit/logit model (Z is a time-invariant continuous variable called "expo" ), and calculate the fitted value, Dhat and then estimate the main equation by IV using Dhat as instrument.
However, I have some doubts about it since I am working with panel data.

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input str1206 zip int year float expo long medhv float collgrad long pop int bldage float(vac own yng) long pcinc float(gini gentri Dhat wht crimerate)
"15201" 2011 5.876458  78500  .3467146 12667 1939   .1480998  .6255746 .15662746 23856 .4439 1  .05610019  .7003237    .02984132
"15201" 2012 5.876458  82200  .3535055 12542 1939  .15243813  .5825847 .18370275 25810 .4611 1  .05610019  .7108914   .033886142
"15201" 2013 5.876458  89600 .40613025 13688 1939   .1384854 .59289575  .2064582 26392 .4498 1  .05610019  .6856371    .02279369
"15201" 2014 5.876458  93900  .4411116 13162 1939  .13020153 .59576595  .2297523 28513 .4677 1  .05610019  .7111381    .02195715
"15201" 2015 5.876458 107400 .48286635 13349 1939    .104796  .5493363  .2613679 31402 .4728 1  .05610019  .7148101    .02120009
"15201" 2016 5.876458 120100 .53500897 12805 1939  .11199768  .5342264  .2866068 36227 .4855 1  .05610019  .7055838   .023037875
"15201" 2017 5.876458 133900  .5767442 12791 1939  .10707594  .5553583  .3048237 39212 .4637 1  .05610019  .7479478   .016652334
"15201" 2018 5.876458 156000  .5950206 12237    0  .10762138 .55569905    .30751 43611 .4649 1  .05610019  .7666095    .02762115
"15201" 2019 5.876458 169800  .6275347 12543    0    .099611 .54358894  .3198597 47792 .4611 1  .05610019  .7731802   .017141035
"15202" 2011 5.674067 104800  .4140105 19762 1942  .12056263  .5423784  .1517559 27781 .4496 1   .3432821  .8995547 .00005060216
"15202" 2012 5.674067 107600  .4142807 19579 1942  .12603523 .53262174  .1579243 28692 .4563 1   .3432821  .8991777 .00005107513
"15202" 2013 5.674067 108000   .438561 19654 1942  .12082385   .529742 .16347817 29474 .4647 1   .3432821  .8885214 .00005088023
"15202" 2014 5.674067 109500  .4583304 19506 1942  .12477651  .5094076 .17005023 30608 .4675 1   .3432821  .8879319 .00005126628
"15202" 2015 5.674067 114800  .4567037 19473 1943   .1223831 .50409836 .17752786 30547 .4625 1   .3432821  .8876907            0
"15202" 2016 5.674067 119600  .4865662 19354 1943  .11307615  .5066639  .2010437 31830 .4606 1   .3432821  .8857601            0
"15202" 2017 5.674067 123500  .4989453 19536 1944  .10606884  .5137299 .21851966 33900 .4602 1   .3432821  .8878993 .00005118755
"15202" 2018 5.674067 133300 .51934314 19566 1944  .10906994 .52126706  .2238066 35811 .4522 1   .3432821   .893131  .0001533272
"15202" 2019 5.674067 137800 .53090817 19569 1943  .10654074  .5133373 .23394144 36908 .4452 1   .3432821  .8726557 .00020440493
"15203" 2011 6.566153 129300 .52399653 10529 1939  .16214107  .4876141 .23867413 34217 .5076 0  -.3517422  .9065439    .07512584
"15203" 2012 6.566153 115000   .517179  9884 1939  .18394864  .4602675 .25991502 37137 .5268 0  -.3517422  .9134966    .09227034
"15203" 2013 6.566153 131700  .5545083 10134 1939   .1950048  .4447096 .23416223 34115 .4917 0  -.3517422  .9290507    .07805408
"15203" 2014 6.566153 143800 .55738235  9992 1939  .20182143   .445599 .22477983 33070  .469 0  -.3517422  .9356485    .08546837
"15203" 2015 6.566153 161600   .567392  9570 1939   .2330576  .4534329 .22873563 35642 .4846 0  -.3517422  .9357367    .08996865
"15203" 2016 6.566153 169300  .5874493 10015 1939   .1989796  .4426752 .28337494 37522 .4724 0  -.3517422  .9183225     .0830754
"15203" 2017 6.566153 199200  .6163474 10171 1939  .19850586  .4399848 .26772195 38212 .4661 0  -.3517422  .9124963    .07069118
"15203" 2018 6.566153 200600  .6086761  9777    0  .21498898  .3955447  .3181958 39125 .4738 0  -.3517422  .8913777     .0705738
"15203" 2019 6.566153 205700  .6192427 10151    0  .20166998  .3806063  .3406561 43417 .4981 0  -.3517422  .8643484     .0577283
"15204" 2011  3.37827  68900 .22327287  7683 1939  .20385078  .6916566 .10425615 19471 .4276 1   .9293568  .5729533    .04386307
"15204" 2012  3.37827  67600  .2450944  8066 1939  .16828322  .6778426 .11046367 19234 .4266 1   .9293568  .5526903    .03930077
"15204" 2013  3.37827  66400   .263988  7647 1939   .1662949  .6982759  .1146855 20505   .41 1   .9293568 .54073495    .04642344
"15204" 2014  3.37827  67200  .2970047  8077 1939  .13197073   .693314 .13086542 22546  .419 1   .9293568 .53943294    .04098056
"15204" 2015  3.37827  63200  .3247963  9028 1939  .10053816  .6790862 .13048294 21068 .4173 1   .9293568 .49789545    .03821445
"15204" 2016  3.37827  67400  .3309823  8554 1942  .10100756  .6688148 .12777647 21496 .4255 1   .9293568  .4762684    .03588964
"15204" 2017  3.37827  70200   .336362  8052 1941  .12734082  .6761087 .14592648 23508  .438 1   .9293568 .52483857   .031793345
"15204" 2018  3.37827  74600  .3587695  8589 1941   .1113831  .6214876  .1597392 23387  .457 1   .9293568   .493189    .01967633
"15204" 2019  3.37827  79100 .35035995  8443    0  .12060665  .6222283 .14177425 23204 .4276 1   .9293568  .5116665     .0197797
"15205" 2011 6.480781 105000  .4058764 22479 1955    .103937  .6079867  .1544108 30712 .4359 0  -.6340553   .870101   .006628409
"15205" 2012 6.480781 107300  .4105296 22312 1956   .0905295 .59490085 .16206525 33389 .4635 0  -.6340553  .8628989   .007439943
"15205" 2013 6.480781 106000  .4230419 22459 1955  .07969151  .5787902  .1740505 32964 .4469 0  -.6340553  .8666459   .006812414
"15205" 2014 6.480781 107800  .4281123 22676 1956  .07633247 .57471484 .18684953 33180 .4549 0  -.6340553  .8618363   .006747222
"15205" 2015 6.480781 110200  .4266594 22476 1955 .063114375 .57236713 .19309485 33552 .4509 0  -.6340553  .8424987   .005961915
"15205" 2016 6.480781 112200  .4392955 22415 1955  .07727067 .55954945 .20771804 32838 .4408 0  -.6340553  .8302476   .007539594
"15205" 2017 6.480781 114800  .4651506 22408 1954  .07879429 .58017606 .20238307 32751  .428 0  -.6340553   .836487   .005132096
"15205" 2018 6.480781 121900  .4674081 22321 1956  .07726663   .596515  .2126697 33989 .4274 0  -.6340553  .8304735   .004076878
"15205" 2019 6.480781 125100  .4916688 21475 1957  .08736728 .58966774  .2023283 35529 .4236 0  -.6340553  .8320373   .003911525
"15206" 2011 6.064228 110400  .4888097 29930 1939   .1633395  .4163818  .1777481 27766 .5249 1   .3971078  .4568326    .04610758
"15206" 2012 6.064228 122100  .4811001 29504 1939  .14184658  .3825532  .1874661 28003 .5352 1   .3971078 .45773456    .04599376
"15206" 2013 6.064228 123600   .465707 29098 1939   .1403675 .39944175 .18324283 27733  .535 1   .3971078  .4617156    .04306138
"15206" 2014 6.064228 130300   .489156 29196 1939  .12198892  .4074971  .1846486 28686 .5348 1   .3971078  .4831484    .04387587
"15206" 2015 6.064228 134000  .4952816 29131 1939  .12165767  .3939708  .1879098 28808 .5412 1   .3971078  .4866637    .03875596
"15206" 2016 6.064228 146800   .534274 28954 1939   .1049698   .398547 .19261587 31152 .5417 1   .3971078  .5101886    .04261933
"15206" 2017 6.064228 157600  .5633456 29557 1939  .10489643  .4061284  .2010353 34579 .5477 1   .3971078 .52265114   .032581113
"15206" 2018 6.064228 167300  .5822883 30014    0  .09131765  .4035582  .2268275 37010 .5437 1   .3971078   .556507   .031518623
"15206" 2019 6.064228 192100  .6058009 29460    0  .09181327  .4041068  .2308554 40584 .5448 1   .3971078 .56045485   .025186693
"15207" 2011 4.675041  76600  .3161711 11564 1939   .1492911  .6523529  .1360256 22533 .4251 1  .59160805  .7243168    .02533725
"15207" 2012 4.675041  76000  .3157702 11263 1939  .15581752  .6320583  .1496049 22681 .4218 1  .59160805   .714552   .029743407
"15207" 2013 4.675041  76200  .3202686 11245 1939  .15393856  .6212982 .14602046 22792 .4353 1  .59160805  .7446865    .02401067
"15207" 2014 4.675041  76500  .3221786 11962 1939  .13948753  .6363636 .15808393 22592 .4441 1  .59160805  .7448587    .02232068
"15207" 2015 4.675041  83000  .3378565 11969 1939  .14785992  .6307326 .14863397 22872 .4657 1  .59160805  .7631381    .02932576
"15207" 2016 4.675041  87800  .3528239 12583 1939  .12897678  .6416584  .1581499 22935 .4715 1  .59160805  .7579274   .024000635
"15207" 2017 4.675041  92900  .3819405 12075 1939  .13411926  .6454223 .16124223 25058 .4644 1  .59160805  .7950311    .02236025
"15207" 2018 4.675041  93700  .3874301 11324    0  .14021815  .6187845 .16116214 25651 .4687 1  .59160805  .7578594   .018014835
"15207" 2019 4.675041  98000  .3941318 10602    0  .15306666  .6456759  .1520468 26824 .4498 1  .59160805  .7690058   .018487077
"15208" 2011 4.965491 111700  .4561099  9822 1939  .23180044 .55423015 .09499083 27493 .5587 0 -.19581676   .325392    .05711668
"15208" 2012 4.965491 111000  .4736307  9873 1939   .1814255 .51934916 .12093589 27800 .5823 0 -.19581676  .3291806    .05803707
"15208" 2013 4.965491  98100  .4629408  9941 1939   .1662967 .51342356 .13660598 26805 .5714 0 -.19581676 .29182175    .05764008
"15208" 2014 4.965491 115700  .5049005  9844 1939  .15634385  .4885428 .13480292 30705 .5969 0 -.19581676 .31470945    .05973182
"15208" 2015 4.965491 137800 .50867224  9852 1939  .17289543  .4739845 .15621194 29757 .6043 0 -.19581676  .3145554    .06049533
"15208" 2016 4.965491 150900  .5215462 10304 1939   .1649732  .4807522 .17663044 30920 .5883 0 -.19581676  .3234666    .05551242
"15208" 2017 4.965491 142600 .50450706 10287 1939  .17850637  .4895787 .16729853 33946 .6042 0 -.19581676  .3251677     .0521046
"15208" 2018 4.965491 164000  .5052922  9824    0  .19016273  .4974035 .17945847 38264  .629 0 -.19581676  .3440554     .0517101
"15208" 2019 4.965491 184500  .4865856  9976    0   .1841012  .4829495 .17181236 37909 .6252 0 -.19581676  .3443264    .04180032
"15209" 2011 5.070668 120800  .3829972 12912 1955 .074382976  .7420008 .15466233 27579 .4152 0   -.475267  .9775403            0
"15209" 2012 5.070668 122300   .377858 12857 1955  .09057177  .7704006 .14194602 27081  .403 0   -.475267  .9677997            0
"15209" 2013 5.070668 126500  .3764706 12875 1954  .09479966   .766246 .13025242 27925  .402 0   -.475267  .9601554            0
"15209" 2014 5.070668 130400  .3973126 12796 1954    .082476  .7585498 .12535167 29575 .4399 0   -.475267  .9692091            0
"15209" 2015 5.070668 130600  .3726338 12694 1954  .09156547   .734646 .10627068 30565 .4582 0   -.475267  .9569876            0
"15209" 2016 5.070668 133400  .3804498 12382 1953  .08698507  .7184972  .1247779 31603 .4449 0   -.475267  .9558229            0
"15209" 2017 5.070668 137400  .3993189 12225 1954  .08136094  .7135445 .13145195 33908 .4424 0   -.475267  .9552556            0
"15209" 2018 5.070668 148100  .4022866 12158 1954  .07484102  .7139584  .1355486 35677 .4448 0   -.475267  .9462905            0
"15209" 2019 5.070668 156800  .4166395 12011 1956   .0752848  .7186217 .14503372 35035 .3972 0   -.475267   .926151            0
"15210" 2011 5.580996  57100 .20929445 26554 1939  .17605788  .6130034  .1432176 17844 .4403 1  .57176465  .6439708    .04150034
"15210" 2012 5.580996  57000 .23255944 27308 1939  .17050317  .6195855 .14178996 18209 .4293 1  .57176465  .6427787   .034495387
"15210" 2013 5.580996  55200  .2234612 27573 1939  .14948764  .5876152 .15707394 18348 .4542 1  .57176465  .6297827    .03670257
"15210" 2014 5.580996  55800  .2316292 27290 1939  .16173017 .57717335 .16141444 18829 .4579 1  .57176465  .6184317   .036277026
"15210" 2015 5.580996  55200 .23991925 27007 1939   .1565237  .5815424 .17188136 19680 .4676 1  .57176465  .6117673    .04147073
"15210" 2016 5.580996  56400 .26457575 26716 1939   .1613593  .5841377  .1654065 20852 .4603 1  .57176465  .6022608    .03930229
"15210" 2017 5.580996  59800 .27427474 26169 1939  .16586114  .5796009  .1691314 21423 .4589 1  .57176465   .616531    .03454469
"15210" 2018 5.580996  64000 .28242296 26616    0   .1524152  .5907695 .16903366 22821 .4663 1  .57176465  .6263902    .02953111
"15210" 2019 5.580996  64900 .28597972 26241    0  .15325077 .56992686 .17263062 22596 .4554 1  .57176465  .6107618    .03056286
"15211" 2011 5.377507  89300  .4305852 11549 1939   .1133458  .4876033  .2440904 31065 .4754 0   .3853092  .8970473    .05480994
"15211" 2012 5.377507  93100   .447809 11622 1939  .11380334  .4776857 .23593186 32613 .4845 0   .3853092  .8946825    .04164515
"15211" 2013 5.377507  86900  .4778459 11428 1939  .13730887  .4755406  .2537627 33168 .4776 0   .3853092   .880994    .03841442
"15211" 2014 5.377507  86200  .5060675 11186 1939  .16341352 .48616385 .26837116 32717 .4579 0   .3853092  .8910245   .036205973
"15211" 2015 5.377507  86200  .4889391 11036 1939  .18257633  .4771361  .2824393 33055 .4701 0   .3853092  .8955237   .035791952
"15211" 2016 5.377507  92300 .51177883 10984 1939  .17775467 .46433085  .2898762 35156 .4722 0   .3853092  .8861981     .0311362
"15211" 2017 5.377507  99400  .4948809 10804 1939  .18905035  .4899547  .3084043 37232 .4728 0   .3853092  .8755091   .034246575
"15211" 2018 5.377507 119100 .50184196 10574    0   .1757684   .493664   .311046 40020 .4835 0   .3853092  .8728958    .03035748
"15211" 2019 5.377507 132700  .5082547 10415    0    .163379  .4937005  .3049448 44678 .4917 0   .3853092   .893903    .02717235
"15212" 2011 6.288301  80300  .3129378 29024 1939   .2049041  .5418321 .15252894 22976 .5049 1  .09191564   .655871    .04027701
end
format %ty year


Since D is time-invariant, should I be concerned by the panel nature of my data when estimating Dhat ?
Can it be viable to estimate Dhat before reshaping my data (as done in the data example), and once my data are long and xtset use it as instrument with the xtivreg command?

Thank you in advance for every comment and hint,

Alessandro