In addition to Ben's excellent program, note
also other efforts in this territory.
http://www.stata.com/support/faqs/data/multresp.html
On structure & shape: the case of multiple responses.
Stata Journal 3(1): 81--99 (2003)
I haven't tried to debug your program, as I suspect
that other more general programs already exist.
Nick
[email protected]
Jann, Ben
> -mrtab- on SSC might help. Type
>
> . ssc install mrtab
>
> to download the program. Then type
>
> . mrtab concern1-concern3, poly response(1/6) countall sort
>
> in order to see a table of counts for the 6 categories. It is
> also possible to save count variable for the individual
> categories:
>
> . mrtab concern1-concern3, poly response(1/6) countall ///
> generate(C)
>
> will produce 6 variables C1-C6 which can then be further
> processed by applying
>
> . collapse ..., by(VID)
>
> A solution to deal with ties would be to apply -mrtab-
> repeatedly: first to concern1-concern3, then to
> concern1-concern2, then to concern1 (or just use
> -tabulate- for the last step).
Farooq Naseer
> > A randomly selected group of people within some survey
> > villages were given the
> > option to pick their top three every-day concerns: Of the six coded
> > options available, a respondent could pick, say, (4,4,2) and another
> > one in the same village could pick (1,6,5). (Duplicates like 4,4,..
> > occur due to the fact that the responses were post-coded into six
> > broad categories to make analysis simpler).
> >
> > Now i want to get a measure for the community's top three priorities
> > by aggregating the information contained in the above individual
> > responses.
> >
> > I have the above info in a stata dataset as variables:
> > concern1-concern3. To avoid complications re. appropriate weighing
> > scheme, for the time being, I just want to take an
> unweighted count of
> > the values in these 3 variables for each village -- the variable VID
> > -- in my sample. In case there is a tie, for instance a village 'j'
> > has 20 responses each for values 4 and 6, I want to pick the value
> > which gets mentioned more in a higher-priority variable acc. to the
> > following priority ranking: concern1 > concern2 > concern3.
> >
> > I know it should be straight-forward to handle in Stata. But after
> > having spent some on it, and seeking help from Stata's Programming
> > manual, the program I produced is not working correctly and is quite
> > inelegant in its use of all the nested loops. I attach the
> program, as
> > is, below. Any help will be (greatly)^greatly appreciated!
> >
*
* 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/