We have measured the spin struction functions g2(p) and g(2)(d) and the virtual photon asymmetries A(2)(p) and A(2)(d) over the kinetmatic range 0.02 less than or equal to x less than or equal to 0.8 and 0.7 less than or equal to Q2 less than or equal to 20 GeV2 by scattering 29.1 and 32.3 GeV longitudinally polarized electrons from transversely polarized NH3 and (LiD)-Li-6 targets. Our measured g2 approximately follows the twist-2 Wandzura-Wilczek calculation. The twist-3 reduced matrix elements d(2)(p) and d(2)(n) are less than two standard deviations from zero. The data are inconsistent with the Burkhardt-Cottingham sum rule if there is no pathological behavior as x --\u3e 0. The Efremov-Leader-Teryaev integral is consistent with zero within our measured kinematic range. The absolute value of A2 is significantly smaller than the A2 \u3c √ R(1 +A1)/2 limit