SPSS Expert: Recording States into Regions with SPSS

Features
March 22, 2011

Often when conducting surveys, you would like to slice your data in regards to specific territories/regions. This can be achieved manually sorting your data and creating groups however; syntax can speed up the process and be reused over and over.

In the example below I’m recoding the State variable provided by Alchemer. (Incidentally, Alchemer is the only provider I’ve found that automatically offers this service and I find it incredibly valuable.)

The first thing I do is recode the string state variable into a numeric variable entitled Region. I’ve put each region on it’s own line. This code is easily adapted to your needs.

Recode State
(“CA”=1)(“OR”=1)(“WA”=1)
(“AZ”=2)(“CO”=2)(“ID”=2)(“NM”=2)(“NV”=2)(“TX”=2)(“UT”=2)
(“AL”=3)(“AR”=3)(“IA”=3)(“IL”=3)(“KS”=3)(“LA”=3)(“MN”=3)(“MO”=3)(“MS”=3)(“OK”=3)(“TN”=3)(“WI”=3)
(“FL”=4)(“GA”=4)(“NC”=4)(“SC”=4)
(“IN”=5)(“KY”=5)(“MI”=5)(“OH”=5)(“PA”=5)(“VA”=5)(“WV”=5)
(“CT”=6)(“DC”=6)(“DE”=6)(“MA”=6)(“MD”=6)(“ME”=6)(“NH”=6)(“NJ”=6)(“NY”=6)(“RI”=6)(“VT”=6)
(“MT”=7)(“ND”=7)(“SD”=7)(“WY”=7)(“NE”=7)
(“AK”=9)(“HI”=9) into Region.

Now I’m labeling the variable and adding value labels.

Var label Region “Region” .
Val labels Region 1″Pacific” 2″Southwest” 3″Central” 4″Southeast” 5″Great Lakes” 6″Northeast” 7″Midwest” 9″Outside”.

Since my client doesn’t operate in Alaska or Hawaii, I’m defining both of their values as system missing. This will prevent me from having to filter them out when I run frequencies.

Missing values region (9).
EXE.

After running/executing you’ll have a new Region variable which groups states as you want them.

  • Get Your Free Demo Today
    Get Demo
  • See How Easy Alchemer Is to Use
    See Help Docs
  • Start making smarter decisions

    Start a free trial

    Request a Demo

    By accessing and using this page, you agree to the Terms of Use . Your information will never be shared.