Oy! There's some misinformation in this thread.

I transit through SJU on a regular basis, from SXM and from other places. If SJU is your first entry into the US then you must clear US Customs and Immigration, and you must pass through TSA security before boarding your ongoing flight. It doesn't matter if you're In Transit to Canada, or are continuing on to a US destination. If you're entering the US then you WILL clear customs and Immigration.