Russ from SAS technical support suggested I use the RESOLVE() function. In order to avoid dropping the incrementor, I used the automatic _N_ variable which was inspired by Paul Dorfman in this paper.
The source code used in the %dsnobs( dsn = ) can be found here.
data rowcounts ;
length name $16
rows 8 ;
array aname[ 2, 2 ] $16 _temporary_
(
'sashelp.cars', 'Cars Rows'
, 'sashelp.class', 'Class Rows'
) ;
do _n_ = 1 to dim( aname ) ;
name = aname[ _n_, 2 ] ;
rows = resolve( cats('%dsnobs( dsn =', aname[ _n_, 1 ], ')' ) ) ;
output ;
end ;
run ;