Statalist The Stata Listserver


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

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


From   "MA V" <[email protected]>
To   [email protected]
Subject   st: Generating a list with combinations' counts and their description
Date   Wed, 23 May 2007 05:01:08 +0000

Dear Statalist users,

My problem is the following:
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.

I tried using egen ...group (var1 var2 var3) but then I am not sure what to do after that in order to obtain the above table.

Thanks for your help.

MA

_________________________________________________________________
PC Magazine�s 2007 editors� choice for best Web mail�award-winning Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_pcmag_0507

*
* 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