IF State-t = "HI" "Hawaii" ELSE IF State-t = "GU" "Guam" ELSE IF State-t = "AL" "Alabama" ELSE IF State-t = "AK" "Alaska" ELSE IF State-t = "AS" "America Samoa" ELSE IF State-t = "AZ" "Arizona" ELSE IF State-t = "AR" "Arkansas" ELSE IF State-t = "CA" "California" ELSE IF State-t = "CO" "Colorado" ELSE IF State-t = "CT" "Connecticut" ELSE IF State-t = "DE" "Delaware" ELSE IF State-t = "DC" "District of Columbia" ELSE IF State-t = "FM" "Federated States of Micronesia" ELSE IF State-t = "FL" "Florida" ELSE IF State-t = "GA" "Georgia" ELSE IF State-t = "ID" "Idaho" ELSE IF State-t = "IL" "Illinois" ELSE IF State-t = "IN" "Indiana" ELSE IF State-t = "IA" "Iowa" ELSE IF State-t = "KS" "Kansas" ELSE IF State-t = "KY" "Kentucky" ELSE IF State-t = "LA" "Louisiana" ELSE IF State-t = "ME" "Maine" ELSE IF State-t = "MH" "Marshall Islands" ELSE IF State-t = "MD" "Maryland" ELSE IF State-t = "MA" "Massachusetts" ELSE IF State-t = "MI" "Michigan" ELSE IF State-t = "MN" "Minnesota" ELSE IF State-t = "MS" "Mississippi" ELSE IF State-t = "MO" "Missouri" ELSE IF State-t = "MT" "Montana" ELSE IF State-t = "NE" "Nebreska" ELSE IF State-t = "NV" "Nevada" ELSE IF State-t = "NH" "New Hampshire" ELSE IF State-t = "NH" "New Jersey" ELSE IF State-t = "NM" "New Mexico" ELSE IF State-t = "NY" "New York" ELSE IF State-t = "NC" "North Carolina" ELSE IF State-t = "ND" "North Dakota" ELSE IF State-t = "MP" "Northern Mariana Islands" ELSE IF State-t = "OH" "Ohio" ELSE IF State-t = "OK" "Oklahoma" ELSE IF State-t = "OR" "Oregon" ELSE IF State-t = "PW" "Palau" ELSE IF State-t = "PA" "Pennsylvania" ELSE IF State-t = "PR" "Puerto Rico" ELSE IF State-t = "RI" "Rhode Island" ELSE IF State-t = "SC" "South Carolina" ELSE IF State-t = "SD" "South Dakota" ELSE IF State-t = "TN" "Tennessee" ELSE IF State-t = "TX" "Texas" ELSE IF State-t = "UT" "Utah" ELSE IF State-t = "VT" "Vermont" ELSE IF State-t = "VI" "Virgin Islands" ELSE IF State-t = "VA" "Virginia" ELSE IF State-t = "WA" "Washington" ELSE IF State-t = "WV" "West Virginia" ELSE IF State-t = "WI" "Wisconsin" ELSE IF State-t = "WY" "Wyoming" ELSE State-t END IF
This computation looks at the text variable State-t for a recognizable two-letter state abbreviation. If it locates one, it will return the proper name for the state. Otherwise it will return the contents of State-t.
Besides the 50 states, the computation will also recognize Guam, Samoa, Micronesia, Puerto Rico, the Virgin Islands, Palau, the Northern Mariana Islands, and the Marshall Islands.
NOTE: By far the easiest way to go from state name to state abbreviation (or vice versa) is to use a multiple choice variable. Use either the state name or the state abbreviation as the multiple choice option text and the other as a merge text value. See Computation #0054: Referencing Multiple Choice Merge Text.