WASHINGTON — House Speaker Paul Ryan will leave Congress having achieved one of his career-long goals: rewriting the tax code. On his other defining aim — balancing the budget and cutting back benefit programs like Social Security and Medicaid — Ryan has utterly failed.

The budget geek with a passion for details proved adroit in drawing up plans that balanced on paper but never got beyond the hypothetical.