proc sort data=sashelp.vcolumn out=temp;
by libname;
where libname eq 'WORK' and memname eq 'TEMP' and type eq 'char';
run;

proc sql noprint;
select count(libname) into: N from temp;
quit;
%put &N;