Very nice! I know I'll be using this alot. Thanks for sharing it.

I think an additional small but valuable improvement, for a future SAS version, could be to follow a similar pattern to that used in SAS/IntrNet and SAS Stored Processes where the macro 'array' has a 0 indexed item containing the count of members (i.e. varVal0). It would save the extra statement with SQLOBS which I know I'll always be doing.