If your variables are changing then proc import may work better.
However, you should never need to type the variables out in a by statement, that sounds insanely inefficient. You may want to go into array processing.
See a brief example below that might help. I'd suggest cleaning/validating within the loop as well to output the final clean value rather than using a separate step.
HTH,
Reeza
[pre]
*Create random data set;
data have;
do i=1 to 10;
a1=i;
a2=i*2;
output;
end;
run;
data have2;
*rename variables to similar to your format;
set have (rename = (a1=_1_APR_95 a2=_1_MAY_95));
*create array based on your data structure;
array orig{*} _1_:;
*loop over array;
do i=1 to dim(orig);
*get variable name in to process;
temp=vname(orig(i));
*convert name to month date format;
variable_name=input(substr(temp, 4, 3)||substr(temp, 8,2), monyy5.);
*get value of observation, you may need to use a temp value and clean it up before assigning final value;
value=orig(i);
*output to transposed dataset;
output;
end;
*drop variables that you don't need anymore;
drop _1_:;
format variable_name monyy7.;
run;
[/pre]
... View more