  Schrieffer-Wolff transformation is a very important transformation in Quantum
Many Body physics. Yet, there isn't an explicit method in the literature to
calculate the generator of this unitary transformation directly from the
hamiltonian. In this paper we present an explicit method to compute the
generator of the Schrieffer-Wolff transformation in general and then calculate
the same for two very important hamiltonians in condensed matter physics, the
Single Impurity Anderson model (SIAM) and its lattice generalization , the
Periodic Anderson Model (PAM). Our method can be used to carry out the
transformation directly from the hamiltonian and the generator of the
transformation can be obtained without any recourse to perturbative expansion
or intuitive guesswork. In fact here, the full generator is calculated rather
than its expansion to first two orders which is usually the case.
