You define a length for StateCD but this variable already exists in your source data set with a different length.
If you really want to change the length then you will have to create a new variable with the same name.
data ds1;
length stateCd $4;
stateCd='ABCD';
output;
stop;
run;
data ds2;
length stateCD $2;
set ds1(rename=(stateCD=_stateCD));
stateCD=_stateCD;
drop _stateCD;
run;
Be aware that like in the code above if the new variable has a shorter length than the string from your source variable, the string might get truncated.