How-To · SPSS

Published November 2026 · 12 min read

AI Coding of Open-Ended Survey Responses in SPSS: A Step-by-Step Guide (with a Sample .sav)

Every SPSS analyst knows the moment. The closed questions are labelled, the weights are set, the tables are half built, and then there is a string variable full of verbatims that nobody has coded. This guide shows how to turn that string variable into labelled 0/1 category variables with AI, without leaving the .sav format, losing a value label, or writing a single line of keyword-matching syntax.

Follow along with the sample files

A fictional public-library patron survey: 240 respondents, value-labelled closed questions, a user-missing code (99 = Prefer not to say) and two open-ended string variables.


The Starting Point: A .sav With an Uncoded String Variable

Open library_survey_2026.sav and switch to Variable View. It looks like most real survey files: numeric closed questions with value labels, and string variables holding the open-ended answers.

Name Type Label Values Missing Measure
resp_idNumericRespondent IDNoneNoneScale
branchNumericBranch visited most often{1, Central}…NoneNominal
age_groupNumericAge group{1, 18-29}…99Nominal
satisfactionNumericOverall satisfaction with the library{1, Very dissatisfied}…NoneOrdinal
q_improveStringWhat one thing would most improve your library?NoneNoneNominal
q_reasonStringWhy did you give that rating?NoneNoneNominal

q_improve is the one we want to code. 225 of the 240 respondents answered it. A few of the actual answers: "Stay open past 6pm so I can come after work", "Open later in the evenings plus a scanner that isn't broken", "It gets very noisy after school", "The car park closes before the library does".

Why Keyword Syntax Is Not the Answer

The traditional SPSS shortcut is to flag categories with string functions:

COMPUTE hours = (CHAR.INDEX(LOWER(q_improve), 'hour') > 0
              OR CHAR.INDEX(LOWER(q_improve), 'close') > 0).
COMPUTE quiet = (CHAR.INDEX(LOWER(q_improve), 'quiet') > 0).
EXECUTE.

Run that against the sample file and the problems show up immediately:

  • Misses: "Stay open past 6pm so I can come after work" is plainly about opening hours and contains neither keyword.
  • False positives: "The car park closes before the library does" matches close and lands in Opening hours, when it is a parking complaint.
  • Synonyms: "It gets very noisy after school" is a quiet-space comment that never uses the word "quiet".

You can keep adding keywords, but you are now maintaining a fragile rule set that has to be rewritten for every question and every survey. It also gives you no way to know what you are missing without reading every answer anyway. The alternative is to have a language model read each answer against a codeframe that you approve.

Step-by-Step: Coding the .sav With SurveyCat

1. Upload the .sav as it is

No export to Excel and no flattening of labels. SurveyCat reads .sav, compressed .zsav and portable .por files up to 20 MB, and keeps the metadata in memory so it can be written back out.

2. Pick the open-ended variables

The column picker shows each variable with its variable label, so you see "What one thing would most improve your library?" rather than guessing what q_improve means, plus a sample answer and how many people answered. Select one or several. Each one is coded independently.

There is an optional context box per question. Use it. A line like "Public library patrons. We are deciding where to spend next year's facilities budget; keep digital services separate from building issues" steers the suggested categories toward the decisions the data has to support.

3. Let the AI propose a codeframe (or type your own)

The AI reads a sample of up to 200 answers and proposes a set of non-overlapping categories, usually four to seven. This costs 5 credits per question on credit packs and is included on monthly plans. If you already have a codeframe from a previous wave or a client brief, tick "Skip AI suggestions, I'll type my own categories". That path is free.

For q_improve the final codeframe used in the sample output is:

  1. Longer opening hours
  2. More books and new titles
  3. Quieter study space
  4. Better Wi-Fi and computers
  5. More events and activities
  6. Parking and access

4. Review, edit and approve

This is the step that makes the output defensible. Rename categories to match your reporting language, merge overlaps, split anything too broad, delete what you will never report. If you want a second opinion, AI refine (3 credits on packs, included on plans) reworks the list using your instructions. Nothing is coded until you confirm. The codeframe that gets applied is yours.

Tip for SPSS users: the order of the list matters. Category 1 becomes q_improve_c01, category 2 becomes q_improve_c02, and so on. Put them in the order you want them in your tables, and keep that order in later waves so your syntax keeps working.

5. Classification runs in the background

Every non-empty answer is read against your approved categories, at 1 credit per answer. Blank answers are not charged. Expect minutes for typical surveys, up to an hour for 5,000+ responses. Coding is multi-label, so an answer like "Open later in the evenings plus a scanner that isn't broken" gets a 1 for both Opening hours and Wi-Fi and computers. In the sample data, 52 of the 225 answers touch two themes.

6. Check and edit the codes

Open Check & edit codes from the results page. Answers the AI was unsure about are flagged, so start there. Click a category to add or remove it from a response, or filter a group (everything coded Parking and access, say, or every answer mentioning "bus") and add, remove or replace a code on all of them at once. Saved edits are written straight into the .sav, and the review log (.xlsx) lists the AI's codes next to your final codes for your QA file.

7. Download the .sav

The results page shows the percentage breakdown for each question. The download is updated_library_survey_2026.sav: your original file plus the new variables. A .por upload comes back as a .sav.

What Comes Back: The New Variables in Variable View

Open library_survey_2026_coded.sav to see the exact structure. The six original variables are untouched. Seven new ones follow:

Name Type Label Values Measure
q_improve_c01NumericWhat one thing would most improve your library?: Longer opening hours{0, No}, {1, Yes}Nominal
q_improve_c02Numeric…: More books and new titles{0, No}, {1, Yes}Nominal
q_improve_c03Numeric…: Quieter study space{0, No}, {1, Yes}Nominal
q_improve_c04Numeric…: Better Wi-Fi and computers{0, No}, {1, Yes}Nominal
q_improve_c05Numeric…: More events and activities{0, No}, {1, Yes}Nominal
q_improve_c06Numeric…: Parking and access{0, No}, {1, Yes}Nominal
q_improve_noneNumeric…: none of the above{0, No}, {1, Yes}Nominal

A few details worth knowing:

  • Short, legal names. A spreadsheet can have a column called q_improve_cat_better_wi-fi_and_computers. SPSS cannot. Names are built from your question variable plus a number and kept inside the 64-character limit. The full category text goes in the variable label, where it belongs.
  • Labels you can table straight away. Each label is question wording: category, so CTABLES and FREQUENCIES output is readable without any extra labelling syntax.
  • Your metadata survives. Value labels, the 99 = Prefer not to say user-missing definition on age_group, measurement levels, display widths and the file label all round-trip. That holds for every variable, not only the ones you coded.
  • The _none variable is 1 when an answer fits none of your categories ("Nothing, it's great") and when the answer was blank. In the sample, 28 respondents have q_improve_none = 1: 15 blanks and 13 "nothing / n/a" answers. Keep that in mind when you choose your base.

Analyzing the Coded Variables in SPSS

Because every category is a 0/1 dichotomy, the standard multiple-response tools work with no reshaping. Here is a complete syntax file for the sample data:

* Open the coded file (adjust the path).
GET FILE='C:\data\updated_library_survey_2026.sav'.

* Base = respondents who actually answered the question.
COMPUTE answered = (q_improve NE '').
FILTER BY answered.

* One table per category.
FREQUENCIES VARIABLES=q_improve_c01 TO q_improve_c06.

* One multiple-response table, % of respondents.
MULT RESPONSE GROUPS=improve 'Suggested improvements'
    (q_improve_c01 TO q_improve_c06 (1))
  /FREQUENCIES=improve.

* Same thing by branch, column % of respondents.
MULT RESPONSE GROUPS=improve 'Suggested improvements'
    (q_improve_c01 TO q_improve_c06 (1))
  /VARIABLES=branch(1,4)
  /TABLES=improve BY branch
  /CELLS=COLUMN
  /BASE=CASES.

FILTER OFF.

On the sample file, the percentage-of-respondents column comes out like this (base: 225 who answered):

CategoryCount% of respondents
Better Wi-Fi and computers5624.9%
Longer opening hours5524.4%
Quieter study space4921.8%
Parking and access4520.0%
More events and activities3415.1%
More books and new titles2511.1%

The column adds up to well over 100% because answers can carry more than one code. That is expected for multiple-response data, and it is why you report "% of respondents" rather than "% of responses".

If you use CTABLES, define the set once with MRSETS /MDGROUP NAME=$improve ... VARIABLES=q_improve_c01 TO q_improve_c06 VALUE=1 and it becomes available in the Custom Tables builder like any other variable. If your file has a weight variable, WEIGHT BY applies to the coded variables exactly as it does to everything else.

Quality-Check the Coding Before You Report It

AI coding is typically typically 85–95% agreement with human coders, depending on how clear your categories are. "Typically" is not "always", so spend ten minutes checking before the numbers go in a deck. List the verbatims behind any category and read them:

* Read the answers coded as Wi-Fi and computers.
TEMPORARY.
SELECT IF q_improve_c04 = 1.
LIST VARIABLES=resp_id q_improve /CASES=FROM 1 TO 25.

* And everything that fell into none of the above.
TEMPORARY.
SELECT IF q_improve_none = 1 AND q_improve NE ''.
LIST VARIABLES=resp_id q_improve.

If the _none list contains a recurring theme, your codeframe is missing a category. Add it and re-run. For academic work, hand-code a random subsample of 50 to 100 answers yourself and report the agreement rate alongside your results. Reviewers increasingly expect that.

Practical Notes for Real Projects

  • Upload the whole file. Every variable comes back, so there is no MATCH FILES step to merge codes into a master file.
  • Several open ends at once. Select them all in one run. Each gets its own codeframe and its own _c01… block.
  • Value-labelled variables. If you ever code a numeric variable that carries value labels, the AI reads the labels ("Very satisfied"), not the raw codes ("5").
  • Privacy. Uploaded files are deleted within 30 minutes (and as soon as classification starts), results within an hour. Response text is not stored.
  • Stata too. If part of your team works in Stata, the same workflow takes a .dta. See coding open-ended responses in Stata.

Frequently Asked Questions

Can I upload an SPSS .sav file directly?

Yes. .sav, .zsav and .por up to 20 MB. You get a .sav back with every original variable, label and missing-value definition, plus the new category variables.

What does it cost to code one open-ended question?

1 credit = one classified response to one question. The sample question has 225 answers, so 225 credits to classify, plus 5 credits if you use AI category suggestions on a credit pack. New accounts get 80 free credits to try it, and credit packs start at $25 for 850 credits.

Will the variable names be the same every time?

Yes, for the same question variable and the same category order, so a syntax file written for wave 1 runs unchanged on wave 2. Our guide to reusing codebooks across survey waves covers how to keep that stable.

The short version

Upload the .sav, approve a codeframe, download the same .sav with labelled 0/1 variables (q_improve_c01…) added. Value labels and missing values stay intact, and MULT RESPONSE or CTABLES work on the result immediately.

Code Your Own .sav File

80 free credits, no credit card. Try it on the sample file first, then on yours.

The SurveyCat Team

SurveyCat is a self-serve verbatim coding tool for researchers, analysts and agencies. It reads and writes SPSS, Stata, Excel and CSV so coding fits the workflow you already have.

Related reading

How to Automatically Code Open-Ended Responses in Stata
How to Code Open-Ended Responses From a Qualtrics Export
How to Reuse a Codebook Across Survey Waves