Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: st: Collapse with sum function and missing values


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   AW: st: Collapse with sum function and missing values
Date   Wed, 10 Feb 2010 12:02:55 +0100

<> 

Or use the -count- provided by -collapse-:



*************
clear

inp group x
1 10
1 11
1 12
2 20
2 21
2 22
3 .
4 .
4 .
5 0
5 .
6 .
6 7
6 0
end

collapse (sum) x (count) nonmiss=x, by(group)
replace x=. if nonmiss==0
drop nonmiss

list 
*************





HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von raoul reulen
Gesendet: Mittwoch, 10. Februar 2010 11:56
An: [email protected]
Betreff: Re: st: Collapse with sum function and missing values

Or use the following suggestion by Nick Cox:

http://www.stata.com/statalist/archive/2004-07/msg00783.html
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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