Autocoding text variables
This example is based on the Museum sample data set.
address{London 'London' _
expression('address.find(""london"") <> -1'),
Liverpool 'Liverpool' _
expression('address.find(""liverpool"") <> -1'),
Aberdeen 'Aberdeen' _
expression('address.find(""aberdeen"") <> -1'),
Leeds 'Leeds' _
expression('address.find(""leeds"") <> -1'),
Edinburgh 'Edinburgh' _
expression('address.find(""edinburgh"") <> -1'),
OtherCities 'Other cities' _
expression('address.find(""london"") = -1
And address.find(""liverpool"") = -1 _
And address.find(""aberdeen"") = -1 _
And address.find(""Leeds"") = -1
And address.find(""Edinburgh"") = -1
And Not address.IsEmpty()'),
NotAnswered 'Not answered' expression('address.IsEmpty()')}
This example creates an axis based on the address text variable and uses custom expressions to automatically code the responses into categories by using the Find function to search for city names.
The text supplied as a parameter to the Find function is enclosed in two double quotation marks (""<text>"").
Here is a table that has this axis on the side:
Table showing variable autocoded using a custom expression
See also