You can control the gif/png file name of traditional SAS/Graph procs by using the "name=" option in the proc. This controls the name of the grseg, and that name is also used as the name of the gif/png file.
In v9.2, you can use the value of the "by" variable as part of the name, and v9.2 also supports >8 characters for the name of the gif/png specified here! 🙂
If deleting all the grsegs is not re-setting the name auto-increment, I would suggest starting a new SAS session each time - I always run my SAS jobs in batch, so that each time it is a fresh invocation, and therefore I don't have to worry about deleting grsegs to reset the name auto-incrementing, etc. (ymmv!)
Below is a v9.2 example that demonstrates using the by-variable to control the png file name:
%let name=map066;
filename odsout '.';
data my_data;
st='NC'; output;
st='SC'; output;
st='VA'; output;
run;
data my_map; set maps.us;
st=fipstate(state);
run;
GOPTIONS DEVICE=png;
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm";
title "This state is #byval(st)";
proc gmap map=my_map data=my_data all;
by st;
id st;
choro st / levels=1
coutline=gray nolegend
des="" name="&name._#byval(st)";
run;
quit;
ODS HTML CLOSE;
ODS LISTING;