You could use PROC SQL similar to the following:
146 proc sql noprint;
147 select name into :val_list separated by ','
148 from sashelp.class;
149 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.05 seconds
cpu time 0.00 seconds
150 %put &val_list;
Alfred,Alice,Barbara,Carol,Henry,James,Jane,Janet,Jeffrey,John,Joyce,Judy,Louise,Mary,Philip,Robert,Ro
nald,Thomas,William