For my SAS class I have to create a format called "$StateCd" that will apply to the variable StateCd (that I have to rename from State), that will change all the observations named "IOWA" to a 2 character long "IA" . This was my attempt:
PROC FORMAT LIBRARY= WORK;
VALUE $StateCd
"IOWA"= "IA";
RUN;
DATA WORK.Contact_IA;
SET HypImpt.IowaResidents (RENAME= (State= StateCd));
FORMAT StateCd $StateCd2.;
RUN;
The format changed all the "IOWA" to "IA" but the length is still 4 like it was before applying the format. This is my first time trying to use a user defined format, what am I doing wrong?
Thank you so much,
Amanda