[...] if your goal is to be the kind of economics professor who engages more directly with the real world, as it seems to be, then some real-world experience is indeed helpful. It broadens your perspective, and it teaches you the skills to understand and communicate with non-economists.
Two years, however, is probably longer than is optimal. My guess is that you will run into rapidly diminishing marginal value from the experience by the end of the first year.
Moreover, a PhD these days often takes five years and sometimes more. That argues for starting sooner rather than later. My experience is that as people start approaching the age of 30, their tolerance for living the life of a grad student declines significantly. As marriage and children start entering your thoughts, you begin to want a real job and a grown-up income. That may be hard to imagine now while you are a college student, but these thoughts will creep up on you faster than you think and when you least expect it.The point of the post is to respond to a question from a student: Should I take a management consulting job before applying to PhD programs, or go straight to graduate school?
Mankiw's answer is useful, but a hidden third option is to seek real world experience during graduate school. Along these lines, several of my classmates have taken summer jobs / internships / working experiences, and have found the experience to be helpful in grounding their research, thinking about data, and gaining perspective on where academic research fits with society at large.
This seems fairly common, and it is healthy to gain perspective. Before going on the job market, one of the most important things you need to consider is what kind of economist you want to be. Some experience with an alternative to academic life can be useful.