Recording States into Regions with SPSS

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 SurveyGizmo. (Incidentally, SurveyGizmo 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
(“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).

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

The SurveyGizmo Developer Toolkit

Supercharge your surveys by unpacking our developer toolkit!

Get the Free Ebook

Join the Conversation
  • David Feng

    Very interesting article and thanks that you provide SPSS code for your analysis.