Hi,

I have an unbalanced panel comprising of data from the years 2005 and 2011. I am trying to run the following command:

xtabond2 logchildwage l.logheadwage i.STATEID GENDER AGE headage POOR childage2 headage2 RELIGION CASTE NPERSONS URBAN if year==2005,
gmm(L2. (logheadwage i.STATEID AGE headage POOR childage2 headage2 RELIGION CASTE NPERSONS URBAN), iv(GENDER)

However, I always get no observations error.

Results from xtdescribe

IDHH: 10201010, 10201130, ..., 3.402e+09 n = 7083
year: 2005, 2012, ..., 2012 T = 2
Delta(year) = 1 unit
Span(year) = 8 periods
(IDHH*year uniquely identifies each observation)

Distribution of T_i: min 5% 25% 50% 75% 95% max
1 1 1 1 1 1 1

Freq. Percent Cum. | Pattern*
---------------------------+----------
4528 63.93 63.93 | .1
2555 36.07 100.00 | 1.
---------------------------+----------
7083 100.00 | XX
--------------------------------------
*Each column represents 7 periods.


Sample of observations from dataex:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(logchildwage logheadwage) int(GENDER AGE RELIGION CASTE POOR NPERSONS URBAN) float(headage childage2 headage2) int(STATEID year)
2.4713535 3.5211756 0 40 0 3 0  8 0 58 1600 3364 1 2005
 2.982179  2.982179 0 21 0 1 0  4 0 48  441 2304 1 2005
 3.293396 4.0422535 0 29 0 2 0  4 1 54  841 2916 1 2005
 4.461453  4.158274 0 27 0 3 0  5 0 53  729 2809 1 2005
2.2131138  2.618579 0 22 1 1 1 10 1 58  484 3364 1 2005
1.4671216 1.4671216 1 28 0 1 1  6 0 55  784 3025 2 2005
 2.562633  4.122881 0 28 0 3 0  6 1 55  784 3025 3 2005
2.0390873 2.0390873 0 20 0 1 0  6 0 48  400 2304 3 2005
2.0969121 1.8431317 0 18 0 2 1  9 0 40  324 1600 2 2005
2.6951096   2.84926 0 29 0 2 0  7 0 54  841 2916 4 2005
 2.512788  2.512788 0 24 0 1 1  9 0 45  576 2025 4 2005
1.7747307 1.7747307 0 20 0 3 0  5 0 50  400 2500 5 2005
2.1467478 2.2802794 1 21 0 1 0  3 0 70  441 4900 5 2005
2.3025851  2.458589 1 17 1 1 0  6 0 50  289 2500 2 2012
 3.218876  3.218876 0 19 0 1 0  5 0 40  361 1600 1 2012
 3.624341  3.624341 0 26 0 1 0  5 0 55  676 3025 1 2012
 1.609438 2.6790626 0 18 0 1 0  5 1 34  324 1156 2 2012
 2.931194  2.484907 0 17 0 1 0  3 1 34  289 1156 2 2012
2.3025851 4.0943446 0 18 0 1 1  4 0 45  324 2025 3 2012
2.1202636  2.813411 0 27 0 1 1  5 1 49  729 2401 3 2012
2.0011096 2.3513753 0 20 1 1 0  3 1 46  400 2116 3 2012
2.1690538 2.0949457 0 20 0 3 0  5 0 49  400 2401 2 2012
2.1690538 2.1690538 0 30 0 2 0  5 0 65  900 4225 2 2012
 2.525729  2.525729 0 28 0 1 0  4 0 65  784 4225 2 2012
1.8325815  2.525729 0 28 0 3 1 10 0 53  784 2809 2 2012
 2.525729  2.525729 1 18 0 2 0  5 0 45  324 2025 2 2012
 2.931194 3.6888795 0 18 1 1 0  8 0 52  324 2704 4 2012
 2.813411  3.218876 1 19 0 3 0  6 0 38  361 1444 5 2012
 3.218876  3.218876 0 19 0 1 1  5 0 49  361 2401 5 2012
 2.931194   2.70805 0 32 0 2 0  4 0 55 1024 3025 5 2012
end
label values GENDER Gender
label def Gender 0 "Male 0", modify
label def Gender 1 "Female 1", modify
label values RELIGION Religion
label def Religion 0 "Hindu", modify
label def Religion 1 "Muslim", modify
label values CASTE CASTE
label def CASTE 1 "General", modify
label def CASTE 2 "SC/ST", modify
label def CASTE 3 "OBC", modify
label values NPERSONS NPERSONS
label values URBAN URBAN
label def URBAN 0 "rural 0", modify
label def URBAN 1 "urban 1", modify
label values STATEID ZonalCouncils
label def ZonalCouncils 1 "Northern Zonal Council- 01", modify
label def ZonalCouncils 2 "Central Zonal Council- 02", modify
label def ZonalCouncils 3 "Eastern Zonal Council- 03", modify
label def ZonalCouncils 4 "Western Zonal Council- 04", modify
label def ZonalCouncils 5 "Southern Zonal Council- 05", modify