[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"patrick cooper" <p.cooper@malatest.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: multiple response to binary |

Date |
Fri, 12 Jul 2002 10:58:42 -0600 |

hi lee for this, if i understand the situation correctly, could concatinate the fields into one long one. then sort then do a freq. or continate the fields (called ALL) and then generate a new field if ALL==1 and so on. patrick ----- Original Message ----- From: "Lee Sieswerda" <Lee.Sieswerda@tbdhu.com> To: "Statalist (E-mail)" <statalist@hsphsun2.harvard.edu> Sent: Friday, July 12, 2002 10:34 AM Subject: st: multiple response to binary > Hello all: > I have a data management problem (WinNT4, Stata v7). > > I have data from a questionnaire where some of the questions allow the > respondent to choose multiple responses. Lets say there 7 possible responses > and they could choose any number of them. I would code this as a set of 7 > binary variables. Unfortunately, the way it was coded was not so > straightforward. It was coded across 7 variables, but the responses were > simply entered in the order in which they were given by the respondent. So > the data look like this: > > f4m1 f4m2 f4m3 f4m4 f4m5 f4m6 f4m7 > 1 7 4 . . . . > 1 . . . . . . > 1 . . . . . . > 1 . . . . . . > 7 3 . . . . . > 1 . . . . . . > 1 2 3 4 . . . > 1 2 3 4 6 . . > 1 2 7 . . . . > 1 . . . . . . > > As you can see, you cannot simply tabulate the number of people who > responded 1, 2 , 3 etc because the responses are scattered over the 7 > variables in a different order for every person. The folks who provided me > with this data use SPSS and they get around this problem by using "multiple > responses sets". In SPSS, you can define a set of variables as a multiple > response set (in this case, seven variables) and then ask for tables of > frequencies and crosstabs generated from across the 7 variables. It works, > but I'd much rather use Stata than SPSS. Also, the SPSS solution is limited > to simple tables and doesn't permit you to get chi-square or other > statistics. > > Now, in Stata I know I can generate dummy variables from this mess like > this: > gen dum1 = 0 > replace dum1 = 1 if f4m1==1 | f4m2==1 | f4m3==1 etc. > replace dum1 = . if f4m1==. & f4m2==. & f4m3==. etc. > gen dum2 = 0 > etc. > > However, this is tedious in the extreme and there are many of these multiple > response questions in the dataset. I could automate the procedure somewhat > using -foreach-, but its still more brute force than elegance. Someone told > me about a SAS solution to this problem using an array procedure. Does > anyone have a nice elegant Stata solution to this problem? > > Thanks, > > Lee > > Lee Sieswerda, Epidemiologist > Thunder Bay District Health Unit > 999 Balmoral Street > Thunder Bay, Ontario > Canada P7B 6E7 > Tel: +1 (807) 625-5957 > Fax: +1 (807) 623-2369 > Lee.Sieswerda@tbdhu.com > www.tbdhu.com > > * > * For searches and help try: > * http://www.stata.com/support/faqs/res/findit.html > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > > * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: multiple response to binary***From:*Lee Sieswerda <Lee.Sieswerda@tbdhu.com>

- Prev by Date:
**st: RE: Question about tabsort (shorter alternative)** - Next by Date:
**st: RE: multiple response to binary** - Previous by thread:
**st: multiple response to binary** - Next by thread:
**st: RE: multiple response to binary** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |