data postal(keep=Name CityState); length State $40; set prog2.people; /* Comma, left parenthesis, colon, semicolon, left bracket, and slash are used as third argument to SCAN function, instead of comma and space, or space to account for multiple word city names, such as "SHORT HILLS," and the various delimiters used. Resulting second word of CITYSTATE is left aligned to eliminate leading blank. The SUBSTR function is used to extract the first two characters only, avoiding the trailing period. */ State=substr(left(scan(CityState,2,',(-:;/[')),1,2); StateName=upcase(stnamel(State)); CityState=scan(CityState,1,',(-:;/') !! ', ' !! StateName; run; proc print data=postal; var Name CityState; run;