Dear all,
SAS's proc mean with the class command expands the
class variables creating all possible combinations
including data with missing data. Is there a way to
do this in Stata?
Thank you,
Ricardo.
Example:
Starting with these data:
Obs a b c n
1 0 0 0 3
2 0 0 1 4
3 0 1 1 5
4 1 1 1 10
5 0 1 0 7
6 0 1 1 5
7 1 0 0 8
8 1 0 1 9
The SAS command:
proc means;
class a b c;
var n;
output sum=tsum ;
Yields:
Obs a b c _TYPE_ _FREQ_ tsum
1 . . . 0 8 51
2 . . 0 1 3 18
3 . . 1 1 5 33
4 . 0 . 2 4 24
5 . 1 . 2 4 27
6 . 0 0 3 2 11
7 . 0 1 3 2 13
8 . 1 0 3 1 7
9 . 1 1 3 3 20
10 0 . . 4 5 24
11 1 . . 4 3 27
12 0 . 0 5 2 10
13 0 . 1 5 3 14
14 1 . 0 5 1 8
15 1 . 1 5 2 19
16 0 0 . 6 2 7
17 0 1 . 6 3 17
18 1 0 . 6 2 17
19 1 1 . 6 1 10
20 0 0 0 7 1 3
21 0 0 1 7 1 4
22 0 1 0 7 1 7
23 0 1 1 7 2 10
24 1 0 0 7 1 8
25 1 0 1 7 1 9
26 1 1 1 7 1 10
Ricardo Ovaldia, MS
Statistician
Oklahoma City, OK
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
*
* 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/