Jean-Benoit Hardouin
I search a method to transform a data as :
Item1 Item2 Item3 Item4 0 0 1 2 1 3 0 1
3 0 2 1
(table of the responses of individuals to four items) in
Item1 Item2 Item3 Item4 Count
0 0 0 0 125
0 0 0 1 88
0 0 0 2 72
0 0 0 3 52
0 0 1 0 28
0 0 1 1 65
0 0 1 2 42
...
where 125 is the number of individuals who have respond 0 to each
item, 88
is the number of individuals who have respond 0 to the first three
item and
1 to the last item, etc.
I don't find how to obtain this kind of table with "reshape" or
"egen" (for
example).
I have idea to program that with four "forvalues..." but perhaps it
exist a
specific command.
For a first-principles solution:
bysort Item? : gen Count = _N
by Item? : gen tag = _n == 1
list Item? Count if tag
For a canned solution, with extra bells and whistles:
ssc inst groups
groups Item? , show(f) showhead(Count)
whelp groups
Nick
[email protected]
*
* 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/