Jim
By using temporary arrays you can do what you want. A temporary array creates a set of values without creating variables. As with all arrays you can loop through them. See the online doc for details
http://support.sas.com/onlinedoc/913/docMainpage.jsp
My strategy was to look at your string as a collection of 6 one position characters. Then build upon that framework to get what you want.
My first exampe creates is the general case. The second example should solve you specific problem. Also my indention didn't make it while i copy/paste the code.
* General;
data One;
/* strategy, create a temporary array with all alphas and loop through to get all posible values */
array Alphas (26) $ 1 _temporary_ ('A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z');
do p1=1 to 26; /* Position 1 of the string being created */
do p2=1 to 26; /* Position 2 of the string being created */
do p3=1 to 26; /* Position 3 of the string being created */
do p4=0 to 999; /* Position 4-6 of the string being created, fortunately creating numbers is easy with SAS formats */
char=alphas[p1]||alphas[p2]||alphas[p3]; /* || = concatenation */
num=put(p4,z3.); /* converts the value of p4 into a text string with leading zeros */
Value=char||num;
output;
end;
end;
end;
end;
run;
** Specific Problem;
data Two;
array Alphas (26) $ 1 _temporary_ ('A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z');
do p1=1 to 3; /* Position 1 of the string being created, stops at C */
do p2=1 to 4; /* Position 2 of the string being created, stops at D */
do p3=1 to 5; /* Position 3 of the string being created, stops at R */
do p4=0 to 999; /* Position 4-6 of the string being created */
char=alphas[p1]||alphas[p2]||alphas[p3];
num=put(p4,z3.);
Value=char||num;
output;
end;
end;
end;
end;
run;
-Darryl