Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(y1 y2 x1 x2) int(x3 x4) byte x5
 89.1  99.6  96.7   101  12  28  1
 99.2 102.6  98.1 100.1  15  35  2
   99 125.6   100   100  17  37  3
  100 130.1 104.9  90.6  22  42  4
111.6 135.6 104.9  86.5  36  47  5
122.2 142.2 109.5  89.7  45  51  6
117.6 157.6 110.8  90.6  66  56  7
121.1 125.2 112.3  82.8  89  60  8
  136   136 109.3  70.1  99  65  9
154.2 154.2 105.3  65.4 118  69 10
153.6 153.6 101.7  61.3 134  74 11
158.5 155.5  95.4  62.5 151  78 12
140.6 140.7  96.4  63.6 167  83 13
136.2 176.2  97.6  52.6 184  87 14
  168 185.8 102.4  59.7 200  92 15
154.3 186.3 101.6  59.5 217  96 16
  149   189 103.8  61.3 233 101 17
end

 fvunab Z: c.x3##c.x4##c.x5
 di "`Z'"
 fvunab XY: c.y2##c.x1##c.x2
 di "`XY'"
 local Y y2
 di "`Y'"
 local X: list XY - Y
 di "`X'"

 ivreg2 y1 `X' (`Y' = `Z')

HTML Code:
.  fvunab Z: c.x3##c.x4##c.x5
.  di "`Z'"
x3 x4 c.x3#c.x4 x5 c.x3#c.x5 c.x4#c.x5 c.x3#c.x4#c.x5
.
.  fvunab XY: c.y2##c.x1##c.x2
.  di "`XY'"
y2 x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2

.  local Y y2
.  di "`Y'"
y2.

.  local X: list XY - Y
.  di "`X'"
x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2

.  ivreg2 y1 `X' (`Y' = `Z')

IV (2SLS) estimation
--------------------

Estimates efficient for homoskedasticity only
Statistics consistent for homoskedasticity only

                                                      Number of obs =       17
                                                      F(  7,     9) =     9.75
                                                      Prob > F      =   0.0014
Total (centered) SS     =  9651.958509                Centered R2   =   0.8824
Total (uncentered) SS   =  297003.9601                Uncentered R2 =   0.9962
Residual SS             =  1135.353606                Root MSE      =    8.172

------------------------------------------------------------------------------
          y1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          y2 |   8.968341   22.04413     0.41   0.684    -34.23736    52.17404
          x1 |   20.51112   35.59004     0.58   0.564    -49.24408    90.26632
             |
   c.y2#c.x1 |  -.0988948   .2215917    -0.45   0.655    -.5332067     .335417
             |
          x2 |   23.23761   40.19759     0.58   0.563    -55.54822    102.0234
             |
   c.y2#c.x2 |  -.1099902    .245903    -0.45   0.655    -.5919513    .3719708
             |
   c.x1#c.x2 |  -.2647819   .4065415    -0.65   0.515    -1.061589    .5320248
             |
   c.y2#c.x1#|
        c.x2 |    .001266   .0025016     0.51   0.613    -.0036372    .0061691
             |
       _cons |  -1717.589   3558.498    -0.48   0.629    -8692.117     5256.94
------------------------------------------------------------------------------
Underidentification test (Anderson canon. corr. LM statistic):          10.961
                                                   Chi-sq(7) P-val =    0.1403
------------------------------------------------------------------------------
Weak identification test (Cragg-Donald Wald F statistic):                0.778
Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    19.86
                                         10% maximal IV relative bias    11.29
                                         20% maximal IV relative bias     6.73
                                         30% maximal IV relative bias     5.07
                                         10% maximal IV size             31.50
                                         15% maximal IV size             17.38
                                         20% maximal IV size             12.48
                                         25% maximal IV size              9.93
Source: Stock-Yogo (2005).  Reproduced by permission.
------------------------------------------------------------------------------
Sargan statistic (overidentification test of all instruments):           9.989
                                                   Chi-sq(6) P-val =    0.1251
------------------------------------------------------------------------------
Instrumented:         y2
Included instruments: x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2
Excluded instruments: x3 x4 c.x3#c.x4 x5 c.x3#c.x5 c.x4#c.x5 c.x3#c.x4#c.x5
------------------------------------------------------------------------------