I am using the xtabond2 command for panel data of country over time to measure the impact of outward foreign direct investment on GDP of country. Whilst running the command and keeping natural log of outward foreign direct investment (lnofdi) as dependent variable and natural log of GDP as key independent variable, I encounter a problem that my observations keep decreasing as I add more variables to the equation. I have 1601 observations in total (and more than 1000 for most variables) but it is less for two variables e.g the minimum is 949 for lnpatent (which measures the number of patents issued in the country in a given year). However when I run the regression the observations decrease to as low as 419.
1). why are my observations decreasing?
2). would it be fine if I present this result ?

input str72 country int year float(lnofdi lngdp lnfuelex lnore lnexp lnimp lnpatent lntrademark lnexrate countryrisk)
"Afghanistan" 2005 0 22.55985 . . 10.843662 7.320975 . . 3.9017706 .
"Afghanistan" 2006 0 22.67737 . . 11.517783 5.22437 . . 3.910622 .
"Afghanistan" 2007 0 23.01011 . . 12.0408 7.773296 . . 3.911223 .
"Afghanistan" 2008 0 23.044725 . . 11.929177 7.898417 . . 3.9170105 -1.86
"Afghanistan" 2009 0 23.24795 . -1.9806697 12.270765 7.22684 . . 3.918601 -1.85
"Afghanistan" 2010 0 23.4919 . -1.2900953 12.074052 8.210782 . . 3.8383765 -1.81
"Afghanistan" 2011 5.991465 23.609755 . -1.1848685 12.345878 8.390061 . . 3.844814 -1.79
"Afghanistan" 2012 0 23.74547 . . 13.047712 8.553827 . . 3.930256 -1.61
"Afghanistan" 2013 0 23.732124 . . 12.701557 9.169028 . . 4.0142183 -1.63
"Afghanistan" 2014 0 23.74934 . . 12.882987 9.762604 . . 4.0474277 -1.53
"Afghanistan" 2015 0 23.678986 1.2385063 .06321213 12.798902 9.3733635 . . 4.1131663 -1.55
"Afghanistan" 2016 0 23.69209 . .11735813 12.97306 8.419382 . . 4.217594 -1.65
"Afghanistan" 2017 5.347107 23.758955 . . 13.201555 8.139621 . . 4.219949 -1.71
"Algeria" 2005 6.697034 25.359915 4.585252 -.7110012 14.155135 12.804174 6.261492 8.568076 4.2942877 .
"Algeria" 2006 8.781095 25.48567 4.5840373 -.3261503 14.482064 11.87145 6.505784 8.648221 4.2856536 .
"Algeria" 2007 0 25.62837 4.582811 -.6761511 14.82419 13.964734 6.744059 . 4.238301 .
"Algeria" 2008 5.075174 25.864935 4.58066 -.4574382 15.137775 13.652073 . 8.642944 4.167905 -.77
"Algeria" 2009 8.009695 25.644785 4.5819173 -.7534351 15.24588 13.760653 . 8.583917 4.2856536 -.85
"Algeria" 2010 0 25.805956 4.578272 -1.2335435 15.201804 13.97875 6.692084 8.567506 4.3093214 -.84
"Algeria" 2011 7.106606 26.02168 4.576739 -1.362777 15.31332 14.488907 6.799056 8.658345 4.289637 -.89
"Algeria" 2012 7.901007 26.06588 4.576107 -1.4020935 15.50499 14.653583 6.802395 8.676758 4.350794 -.88
"Algeria" 2013 7.489971 26.069206 4.571841 -1.7896906 15.611245 14.587722 6.733402 8.141481 4.3741207 -.81
"Algeria" 2014 7.229839 26.088354 4.561889 -1.716518 15.816339 14.089106 6.700731 9.191871 4.3892503 -.86
"Algeria" 2015 5.598422 25.834494 4.5467553 -1.1741533 15.841465 13.550715 6.690842 8.95131 4.6120467 -.86
"Algeria" 2016 8.116715 25.79248 4.543211 -1.379219 15.849936 12.712547 6.510258 8.874028 4.6953764 -.87
"Algeria" 2017 0 . . . 15.730187 13.01327 . . . .
"Angola" 2005 7.512071 24.06378 . . 12.82878 15.699823 . . 4.467746 .
"Angola" 2006 6.60665 24.45591 . . 13.70367 16.207323 . . 4.386641 .
"Angola" 2007 0 24.825064 4.5614085 .9841087 14.026192 16.371859 . . 4.340032 .
"Angola" 2008 8.083328 25.1562 . . 14.89476 16.923792 . . 4.317888 -1.03
"Angola" 2009 7.265429 25.0473 4.5707006 .6941624 14.685112 16.501713 . . 4.373616 -.99
"Angola" 2010 0 25.13638 4.569901 .711787 14.510592 16.94293 . . 4.5208097 -.99
"Angola" 2011 8.089482 25.36877 4.5701313 .5990068 14.839455 17.03127 . . 4.5425496 -1.05
"Angola" 2012 6.214608 25.45879 4.576544 .4489815 15.21155 17.328901 . . 4.558812 -.98
"Angola" 2013 7.659172 25.550884 4.571402 .5349199 15.19278 17.280392 . . 4.5697503 -1.05
"Angola" 2014 7.478735 25.565325 4.566371 .7810057 15.603094 17.252913 . . 4.588024 -1
"Angola" 2015 6.413459 25.35431 4.553822 1.1989267 15.128467 16.5882 . . 4.787992 -.98
"Angola" 2016 8.104704 25.280685 . . 14.33454 16.452145 . . 5.097791 -.98
"Angola" 2017 8.166216 25.54523 . . 14.629747 16.845581 . . 5.111506 -.98
"Azerbaijan" 2005 0 23.30694 4.3407435 .334476 12.36156 10.102376 5.659482 8.343316 -.05129331 .
"Azerbaijan" 2006 0 23.76698 4.437832 .29353815 12.756133 9.999652 5.556828 8.468423 -.11653383 .
"Azerbaijan" 2007 5.347107 24.2213 4.3993626 .56839484 13.07144 7.273934 5.686975 8.430763 -.1508229 .
"Azerbaijan" 2008 6.086775 24.61207 4.575564 -1.2440186 13.438776 11.651502 5.451038 8.672315 -.19845095 -.69
"Azerbaijan" 2009 0 24.51406 4.5310593 -1.3864945 13.223636 11.762257 5.638355 8.3795395 -.22314353 -.66
"Azerbaijan" 2010 0 24.69172 4.5487003 -2.1687117 13.64846 11.368447 5.602119 8.392083 -.22314353 -.71
"Azerbaijan" 2011 4.6051702 24.91219 4.551214 -1.642851 13.701915 12.17417 5.32301 8.538172 -.2357223 -.75
"Azerbaijan" 2012 0 24.967236 4.5370984 -.6306698 13.883008 12.274487 4.969813 8.56121 -.2357223 -.78
"Azerbaijan" 2013 0 25.02955 4.5324388 -.7181144 13.674602 12.361294 5.049856 8.651375 -.2484614 -.6
"Azerbaijan" 2014 0 25.044006 4.5287037 -.6690831 13.377398 12.6017 5.123964 8.575651 -.2484614 -.58
"Azerbaijan" 2015 0 24.69496 4.466174 -.03621774 12.992586 12.314497 5.214936 8.507546 .01980261 -.57
"Azerbaijan" 2016 0 24.35736 4.47181 .480997 12.753857 12.928977 5.09375 8.455743 .4700036 -.52
"Azerbaijan" 2017 0 24.43067 4.501358 .3067038 12.866106 13.266383 . . .5423243 -.52
"Bahrain" 2005 0 23.4939 4.358749 2.7231324 12.138857 11.140986 . 8.119101 -.967584 .
"Bahrain" 2006 0 23.64131 4.389376 2.6260245 12.556444 11.079296 . 8.508354 -.967584 .
"Bahrain" 2007 0 23.80196 4.392351 2.3796284 12.863553 11.537094 . 8.67744 -.967584 .
"Bahrain" 2008 0 23.97018 4.235013 2.838019 13.392508 11.78537 . 8.603738 -.967584 .32
"Bahrain" 2009 0 23.85607 4.2283225 2.73191 13.071732 12.260736 . 9.031214 -.967584 .35
"Bahrain" 2010 0 23.970274 4.3087497 2.895874 13.591745 12.436836 . . -.967584 .26
"Bahrain" 2011 0 24.08283 4.274496 3.065493 13.68769 12.69415 4.941642 8.815518 -.967584 .17
"Bahrain" 2012 0 24.149134 4.1612053 3.0489635 14.000148 12.76095 5.099866 8.793308 -.967584 .15
"Bahrain" 2013 0 24.20572 4.077623 2.909134 14.029758 12.62866 5.135798 8.923592 -.967584 .12
"Bahrain" 2014 0 24.231453 4.202222 2.711129 14.023973 12.122498 5.32301 8.885441 -.967584 .21
"Bahrain" 2015 0 24.161304 4.0629354 2.968987 13.827288 11.622164 5.26269 8.941415 -.967584 .17
"Bahrain" 2016 0 24.19376 4.0078945 3.12583 13.58041 11.062295 5.17615 8.9758835 -.967584 .12
"Bahrain" 2017 0 24.28735 . . 13.712946 11.7276 5.501258 8.836374 -.967584 -.01
"Bangladesh" 2005 0 24.96377 -.5457429 -1.6300665 14.69212 11.272166 5.840641 8.912608 4.1640263 .
"Bangladesh" 2006 0 24.997416 -.27251613 -1.0936779 14.943812 11.50121 5.736572 8.8450575 4.2330914 .
"Bangladesh" 2007 0 25.10043 .4843041 -.850794 15.0244 11.645453 5.700444 9.095266 4.2322206 .
"Bangladesh" 2008 0 25.24104 .3440607 -1.11776 15.331972 11.78987 5.823046 9.1964445 4.2282925 -.99
"Bangladesh" 2009 5.135798 25.352915 .5462139 -1.1051521 15.306405 11.85454 5.799093 9.138414 4.234686 -1.01
"Bangladesh" 2010 6.633318 25.47062 .6277574 -.7730961 15.730828 12.502006 5.834811 9.233177 4.2434826 -.97
"Bangladesh" 2011 6.672033 25.58027 .1414784 -.8020568 15.871 13.01486 5.723585 9.362632 4.30609 -.96
"Bangladesh" 2012 6.536692 25.61629 .51598334 -.8673289 15.891207 13.080974 5.869297 9.343909 4.4050107 -.98
"Bangladesh" 2013 6.64639 25.733835 .12737493 -1.1571411 16.088161 13.30862 5.713733 9.357121 4.3579903 -1.02
"Bangladesh" 2014 7.828038 25.87589 . . 16.282106 13.54253 5.680172 9.353662 4.3520827 -.85
"Bangladesh" 2015 8.368693 25.99667 -.57700133 -1.7595885 16.447018 13.613205 5.828946 9.457903 4.3560677 -.88
"Bangladesh" 2016 9.180912 26.123304 . . 16.475815 13.675556 5.840641 9.423433 4.362716 -.85
"Bangladesh" 2017 8.306472 26.24362 . . 16.534765 13.682144 5.710427 9.479604 4.3875117 -.86
"Belarus" 2005 0 24.13136 3.5447016 -.632843 11.30565 13.103064 7.28756 9.008836 -1.5141277 .
"Belarus" 2006 0 24.33295 3.642261 -.7076019 12.2821 12.968684 7.32975 9.132271 -1.5606477 .
"Belarus" 2007 6.429719 24.536074 3.55304 -.4222855 12.333706 13.325447 7.415777 9.281917 -1.5606477 .
"Belarus" 2008 5.799093 24.830256 3.608944 -.6732613 12.797638 13.118002 7.455877 9.251194 -1.5606477 -.71
"Belarus" 2009 0 24.61935 3.61809 -.5190553 12.544048 13.179866 7.5632 9.1388445 -1.2729657 -.68
"Belarus" 2010 6.887553 24.77021 3.315969 -.349989 13.586864 13.073378 7.566828 9.244355 -1.2039728 -.82
"Belarus" 2011 7.286192 24.846485 3.5738554 -.52272344 13.466145 13.303795 7.534228 9.2475395 -.6931472 -.83
"Belarus" 2012 5.991465 24.90814 3.628111 -.4891729 13.73193 13.404727 7.534228 9.313979 -.1863296 -.67
"Belarus" 2013 0 25.04777 3.469639 -.09061532 13.678728 13.271667 7.398786 9.31109 -.11653383 -.67
"Belarus" 2014 5.828946 25.090355 3.5015814 -.1472572 13.920406 13.512074 6.629363 9.025696 .01980261 -.49
"Belarus" 2015 6.684612 24.756704 3.364393 -.07757697 13.526362 13.826262 6.53814 8.911261 .463734 -.5
"Belarus" 2016 6.745236 24.58867 3.020929 .21122946 13.901706 12.983536 6.25575 8.886409 .6881347 -.45
"Belarus" 2017 0 24.72041 . . 13.746548 13.152667 6.261492 8.929965 .65752 -.43
"Belgium" 2005 0 26.682636 1.9441366 .9683866 15.86175 15.20317 6.43294 . . .
"Belgium" 2006 0 26.738966 2.0639007 1.2646222 16.108656 15.275125 6.478509 . . .
"Belgium" 2007 0 26.879866 1.947181 1.3064365 16.356258 15.419568 6.424869 . . .
"Belgium" 2008 0 26.97445 2.2192712 1.2069708 16.514944 15.49017 6.562444 . . 1.23
"Belgium" 2009 0 26.90649 2.0093386 1.0111203 16.201775 15.581848 6.705639 . . 1.31
"Belgium" 2010 0 26.904417 2.1737518 1.298318 16.475922 15.874681 6.633318 . . 1.32
"Belgium" 2011 0 26.99048 2.3749986 1.3328618 16.758572 16.131105 6.637258 . . 1.37
"Belgium" 2012 5.560682 26.933634 2.439434 1.2988948 16.61137 16.114565 6.782192 . . 1.36
"Belgium" 2013 0 26.97887 2.557801 1.1049488 16.560226 16.102787 6.775366 . . 1.39
end
format %ty year
[/CODE]
------------------ copy up to and including the previous line ------------------

Listed 100 out of 1601 observations
Use the count() option to list more



. xtabond2 lnofdi l.lnofdi l.lngdp l.lnfuelex l.lnimp l.lnexp l.lnore l.lnexrate l.countryrisk l.lnpatent l.lntrademark yr2005-yr2018 , gmm
> ( yr2006 yr2008 l.( lnofdi lngdp lnimp ), ) iv(yr2005-yr2018 , eq(level)) robust small nodiffsargan pca
Favoring speed over space. To switch, type or click on mata: mata set matafavor space, perm.
Warning: Two-step estimated covariance matrix of moments is singular.
Using a generalized inverse to calculate robust weighting matrix for Hansen test.

Dynamic panel-data estimation, one-step system GMM
------------------------------------------------------------------------------
Group variable: i Number of obs = 419
Time variable : year Number of groups = 59
Number of instruments = 37 Obs per group: min = 224
F(24, 58) = 2.19 avg = 7.10
Prob > F = 0.008 max = 224
------------------------------------------------------------------------------
| Robust
lnofdi | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lnofdi |
L1. | .1037618 .0889471 1.17 0.248 -.0742852 .2818088
|
lngdp |
L1. | -.0184413 1.478223 -0.01 0.990 -2.977425 2.940543
|
lnfuelex |
L1. | .2832461 .347006 0.82 0.418 -.4113619 .9778541
|
lnimp |
L1. | .7705109 .7224463 1.07 0.291 -.6756224 2.216644
|
lnexp |
L1. | -.5281861 1.789045 -0.30 0.769 -4.10935 3.052977
|
lnore |
L1. | -.9537841 .7346478 -1.30 0.199 -2.424341 .5167732
|
lnexrate |
L1. | .5731677 .4670224 1.23 0.225 -.3616793 1.508015
|
countryrisk |
L1. | -.3783878 1.799179 -0.21 0.834 -3.979837 3.223061
|
lnpatent |
L1. | .4370589 .8746079 0.50 0.619 -1.313659 2.187777
|
lntrademark |
L1. | -.8808551 1.921303 -0.46 0.648 -4.72676 2.96505
|
yr2005 | 0 (omitted)
yr2006 | 0 (omitted)
yr2007 | 0 (omitted)
yr2008 | 0 (omitted)
yr2009 | -.9181713 .9751007 -0.94 0.350 -2.870047 1.033705
yr2010 | -.6001396 1.13682 -0.53 0.600 -2.875732 1.675452
yr2011 | -.1547399 .7599811 -0.20 0.839 -1.676007 1.366528
yr2012 | -.2169287 .5293539 -0.41 0.683 -1.276546 .8426883
yr2013 | -.006641 .6191034 -0.01 0.991 -1.245911 1.232629
yr2014 | -.5978645 .5806108 -1.03 0.307 -1.760083 .5643544
yr2015 | 0 (omitted)
yr2016 | .3154751 .4942438 0.64 0.526 -.6738614 1.304812
yr2017 | .5535534 .7749759 0.71 0.478 -.9977294 2.104836
yr2018 | 0 (omitted)
_cons | 5.903083 29.05159 0.20 0.840 -52.24999 64.05616
------------------------------------------------------------------------------
Instruments for first differences equation
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/12).(yr2006 yr2008 L.lnofdi L.lngdp L.lnimp)
Instruments for levels equation
Standard
yr2005 yr2006 yr2007 yr2008 yr2009 yr2010 yr2011 yr2012 yr2013 yr2014
yr2015 yr2016 yr2017 yr2018
_cons
GMM-type (missing=0, separate instruments for each period unless collapsed)
D.(yr2006 yr2008 L.lnofdi L.lngdp L.lnimp)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -4.58 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = 0.47 Pr > z = 0.637
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(12) = 19.63 Prob > chi2 = 0.074
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(12) = 17.27 Prob > chi2 = 0.140
(Robust, but weakened by many instruments.)
------------------------------------------------------------------------------
Extracted 28 principal components from GMM-style instruments
Portion of variance explained by the components = 0.856
Kaiser-Meyer-Olkin measure of sampling adequacy = 0.903