Statalist The Stata Listserver


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

st: RE: pairwise dummy variables


From   "Maarten Buis" <M.Buis@fsw.vu.nl>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: pairwise dummy variables
Date   Wed, 3 May 2006 11:02:09 +0200

Serguei Kaniovski wrote:
> I am new to STATA and have the following problem. I would like to
> compute the frequencies of occurrence (and counts) of all possible
> voting arrangements between voters "voter_id" in a voting body
> "body_id". The vote is a binary variable indicating the yes and no
> votes. Given each voter's "vote", there would be nC2-1 such
> arrangements.

Serguei:
I am pretty new to STATA too (but not to Stata, see
http://www.stata.com/support/faqs/res/statalist.html#spell)
This can be solved with the -table- command with the replace option,
see -whelp table- and example below.
HTH, 
Maarten

*-----------------begin example--------------------
input body_id voter_id vote
1 1 1
1 2 0
1 3 1
1 7 1
1 9 0
2 1 1
2 2 0
2 7 0
end

table voter_id, c(N vote) by(body_id) replace
*-----------------end example---------------

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index