Statalist The Stata Listserver


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

Re: st: Generating a list with combinations' counts and their description


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: Generating a list with combinations' counts and their description
Date   Wed, 23 May 2007 08:34:01 +0200

MA wrote:

I have 3 variables that can take the values 1 up to 3 and the data looks
something like this

obs var1 var2 var3
1 2 2 1
2 2 2 1
3 1 2 3
4 3 3 3

I would like to obtain a table that says how many observations I have of
each existing combination. But I would like this table to have a
"description" for each of the combinations. i.e. the resulting table
would be something like this:

var1 var2 var3 count
1 2 3 1
2 2 1 2
3 3 3 1

Note also that the lines in the table are ordered by the values of var1,
var2 and var3.

--------------------------------------------------

Nick Cox made the -groups- command; it does what you want. Get it by:

   ssc install groups

Hope this helps
Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: [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/



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