My data has the following variables:
SSN ($11)
Inits ($4)
City ($20)
ZipCd (8)
StateCd ($2)
The following is the code I have:
DATA WORK.XXX;
SET YYY;
IF State = 'IOWA' THEN StateCd = 'IA';
KEEP SSN -- ZipCd;
KEEP StateCd;
DROP Sex -- BirthDt;
DROP State;
Initials=CATS(Scan(Initials, -1, ','), SCAN(Initials, 1, ','));
RENAME Initials = Inits;
City = PROPCASE(City);
RUN;
I am trying to change the 'ZipCd' variable from numeric to character as well as change the length from 8 to 5. I have tried a PUT function but due to the other statements in my code I am unsure on the placement of the PUT function that will allow these changes.
Thank you!