Folks, there is a limitation to PRINT. It can print 4000 nvarchar() and 8000 varchar().
After sending out my previous message, I realized that the solution is even simpler than what I proposed, requiring no temp tables and no custom-developed sprocs at all: after building the long string as varchar(max) or nvarchar(max), rather than using PRINT, use SELECT, then copy-n-paste the result into your preferred text editor for analysis.
Mike Vassalotti
Herndon, Virginia