Some data sets use the first three characters or Forward Sorting Area (FSA) of the Canadian Postal Code to define Province or a urban-rural variable. Here are the SPSS syntax commands to use to define these variable with the Forum Research Data available through Dataverse.

*Syntax to define Province and Urban/Rural for the Forum Research Data*.
*For Province*.
if (substr(fsa,1,1)='A') Province=10.
if (substr(fsa,1,1)='B') Province=12.
if (substr(fsa,1,1)='C') Province=11.
if (substr(fsa,1,1)='E') Province=13.
if (substr(fsa,1,1)='G' or substr(fsa,1,1)='H' OR
   substr(fsa,1,1)='J') Province=24.
if (substr(fsa,1,1)='K' or substr(fsa,1,1)='L' or substr(fsa,1,1)='M'
   or substr(fsa,1,1)='N' or substr(fsa,1,1)='P') Province=35.
if (substr(fsa,1,1)='R') Province=46.
if (substr(fsa,1,1)='S') Province=47.
if (substr(fsa,1,1)='T') Province=48.
if (substr(fsa,1,1)='V') Province=59.

VARIABLE LABELS Province 'Province'.
value labels Province 10 "Newfoundland" 11 "PEI" 12 "Nova Scotia"
   13" New Brunswick" 24 "Quebec" 35 "Ontario" 46 "Manitoba"
   47 "Saskatchewan" 48 "Alberta" 59 "BC".

fre var Province.


*For Rural/Urban*.
numeric nrururb.
string rururb (a1).
compute rururb = substr(fsa, 2, 1).
recode rururb ('0' = 0) ('1','2','3','4','5','6','7','8','9'=1)into urban.
value labels urban 0 'rural' 1 'urban'.

fre var urban.