@stat_joey
I'm very much with @RW on the same page that you shouldn't try to patch the problem but have the root cause resolved.
Using the error message for Googling...
TCP Provider: Timeout error [258]
...it appears this is not an uncommon issue and the first step could be to increase timeout settings.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/35d02688-b2c5-47ab-99c2-050d62aa2277/tcp-provider-timeout-error-258-under-heavy-logonlogoff-load?forum=sqldataaccess
As this issue seems to be related by too many login requests at the same time, you could also try and reduce the login requests from your SAS program by using a global connections (=reusing already established connections).
http://go.documentation.sas.com/?docsetId=acreldb&docsetTarget=n166tqlopg9p0bn1okz4ilmde7mp.htm&docsetVersion=9.4&locale=en#n13l7ofi73kcy7n13qenke59lpzl
If you've got also other connection problems like interrupted connections for long running queries then you need to talk to your DBMS and Network guys.
SAS doesn't have a SQL retry option. You could eventually implement such a try-catch mechanism but it feels like quite a bit of work to make this stable and it's certainly something I'd do only for some isolated critical use case and not something for every single SQL you issue because adding such try-catch logic will most likely complicate code development and maintenance significantly.
... View more