Hi!
I have a variable with postal codes, see example below. However, the format of the different entries differs. I want to make a new variable that shows the postal code in the following manner: '1111AA'. So, four numbers followed by two letters in capitals without spaces.
Does anyone knows how to do that?
I have a variable with postal codes, see example below. However, the format of the different entries differs. I want to make a new variable that shows the postal code in the following manner: '1111AA'. So, four numbers followed by two letters in capitals without spaces.
Does anyone knows how to do that?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str15 kokpostcode "1011ex" "1011ex" "1011 CV" "1011 CV" "1011MZ" "1011ex" "1011ex" "1011KW" "1011ex" "1011tv" "1011 TT" "1011ex" "1011ex" "1011ex" "1011 CV" "1011ex" "1011 CW" "1011TE" "1011 TT" "1011KC" "1011RG" "1011MZ" "1011 TT" "1011 CV" "1011KC" "1011ex" "1011TE" "1011ex" "1011KC" "1011VA" "1011 CV" "1011 TT" "1011ex" "1011ex" "1011 CW" "1011ex" "1011 CW" "1011ex" "1011ex" "1011 CV" "1011KW" "1011ex" "1011ex" "1011ex" "1011 CV" "1011ex" "1011 TT" end
Comment