someone on SAS-L asked how to macro-ise running proc means for each value of a "name". I offered an ods option through by-group processing very similar to Cynthia's (but not as neat). What my method added was the renaming of files from the default name1, name2..... nameNNN with the name in the by-value....
The whole posting can be seen at
http://listserv.uga.edu/cgi-bin/wa?A2=ind0901d&L=sas-l&P=27266 . The final part replacing default names with class value/by-group value, is adapted here for Cynthia's example (except I would name her first file peeps1000.csv:[pre]data _null_ ;
length dir1 $8 odsnm $100 ;
* prepare a command file for rename commands;
file 'c:\temp\rens.bat' ;
* the first command prepares "current folder" ;
put "cd /d ""c:\temp"" ";
rc = filename( dir1, 'c:\temp' );
di = dopen( dir1 );
memcount= dnum( di ) ;
do memn= 1 to memcount ;
odsnm = dread( di, memn );
if scan( odsnm, -1, '.' ) ne 'csv' then continue ;
if odsnm ne: 'peeps' then continue ;
do until( last.name ) ;
set salesinfo ;
by name ;
end;
nmq = quote( trim( odsnm));
newq= quote( trim( name )!!'.csv' ) ;
put 'ren ' nmq +1 newq ;
end;
rc = dclose( di );
rc = filename( dir1, ' ' );
stop;
run ;[/pre]Then to execute that command file rens.bat, I chose to demonstrate call system, with[pre]option noxwait xsync ;
data _null_ ;
call system( 'c:\temp\rens.bat' ) ;
stop;
run ;[/pre]
Beware that this version adapted for CSV files, I isn't tested (yet).
Hope you'll find it interesting
PeterC