Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: cumulative adding


From   "Jonathan A. Schwabish" <[email protected]>
To   Statalist <[email protected]>
Subject   st: cumulative adding
Date   Wed, 21 Sep 2005 17:30:54 -0700 (PDT)

I'm sure this is an easier task than I'm making it out
to be but I'm trying to create a cumulative tally of a
binary variable. To illustrate, my data set has the
variable 'X' and I'd like to create the 'sumX'
variable: 

'X' 'sumX'
 0    0
 1    1
 1    2
 1    3
 0    3
 1    4

I've tried writing a simple macro but can't get the
thing to work. Any suggestions?

Thanks,
Jon Schwabish

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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