LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Jun 2004 23:45:50 -0400
Reply-To:     Richard Ristow <wrristow@mindspring.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <wrristow@mindspring.com>
Subject:      Re: Multiple response field
Comments: To: Emily Lander <emily.lander@pcmail.maricopa.edu>
In-Reply-To:  <40C879EC.6060708@pcmail.maricopa.edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 11:10 AM 6/10/2004, Emily Lander wrote:

>Is there a way for SPSS to recognize multiple responses in one field?

There is not, but there are other ways to solve this problem.

>I am going to be doing a frequency table with this variable, so I >simply need it to list each of the 3 responses in the frequency table.

This is what MULT RESPONSE is for. From the syntax manual,

"MULT RESPONSE displays frequencies and optional percentages for multiple-response items in univariate tables and multivariate crosstabulations. Multiple-response items are questions that can have more than one value for each case. [...] You can organize multiple-response data in one of two ways for use in the program. * For each possible response, you can create a variable that can have one of two values, such as 1 for no and 2 for yes; this is the multiple-dichotomy method. * Alternatively, you can estimate the maximum number of possible answers from a respondent and create that number of variables, each of which can have a value representing one of the [...] answers, such as 1 for Time, 2 for Newsweek, and 3 for PC Week. If an individual did not give the maximum number of answers, the extra variables [should] receive a missing-value code. This is the multiple-response or multiple-category method of coding answers."

Now, the question is, how to get there? I'll suggest the second method for your situation. You wrote,

>I have a survey where respondents "check all that apply." I use >another program to scan in survey responses, and when it encounters a >multiple response it enters all the responses into the field as: >(1,4,5), for example.

The following code is UNTESTED:

/* Assumptions: */ /* 1. The original data is in a string */ /* variable named RESPONSS, in its */ /* original form, e.g. "(1,4,5)", of */ /* length 12. */ /* 2. No person has more than 5 responses.*/ /* 3. No response has more than two */ /* digits. */ /* 4. The maximum numerical value for a */ /* response is 10. */ /* 5. Responses are terminated ONLY by */ /* commas or right parentheses, and a */ /* right parenthesis ends the string. */ /* */ /* NOTES: /* A. The limits of 12 character for */ /* "RESPONSS", 5 responses maximum, */ /* two digits for a response, and a */ /* maximum value of 10, can be */ /* increased easily. */ /* B. This code has almost no checking */ /* for errors such as a string that */ /* does not start with a left paren. */

VECTOR RESP(5,F2). VALUE LABELS RESP1 to RESP5 1 'Meaning of response 1' <etc.>.

STRING #ALL_RSP (A12)./* All responses, to parse */ STRING #ONE_RSP (A2). /* One response, as string */ NUMERIC #STR_LOC (F2). /* Pointer, into the string*/ NUMERIC #RSP_NUM (F2). /* Response counter */

COMPUTE #ALL_RSP = LTRIM(RESPONSS).

LOOP #RSP_NUM = 1 TO 5. * Find a response: i.e., any numeral . . COMPUTE #STR_LOC = INDEX(#ALL_RSP),'0123456789',1). . DO IF #STR_LOC = 0. * If no response is found, stop . . BREAK. . ELSE. * Drop everything before the response . . COMPUTE #ALL_RSP = SUBSTR(#ALL_RSP,#STR_LOC). * Find the punctuation that ends the response . . COMPUTE #STR_LOC = INDEX(#ALL_RSP,',)',1). . DO IF #STR_LOC = 0. * The response is the rest of the string . . COMPUTE #ONE_RSP = #ALL_RSP. . ELSE. * The response is up to the punctuation . . COMPUTE #ONE_RSP = SUBSTR(#ALL_RSP,1, #STR_LOC-1). . END IF. * Convert the response to a number, and save . . COMPUTE RESP(#RSP_NUM) = NUMBER(#ONE_RSP,F2). . END IF. END LOOP.

* Then, use the responses as a mult-response set. MULT RESP GROUPS=RESPS 'Responses to the survey question' RESP1 TO RESP5 (0,10) /FREQUENCIES RESPS.

Also from the syntax manual:

"Another procedure that analyzes multiple-response items is TABLES, which has most, but not all, of the capabilities of MULT RESPONSE. TABLES has special formatting capabilities that make it useful for presentations."


Back to: Top of message | Previous page | Main SPSSX-L page