Hi, I have a simple question. I would like to have a cumulate sum that restarts if observing 0 in the original column. I have a simple example. Is there an easy way to do this? I tried several ways to do this, but couldn't figure out a way to do this.
ex)x is a column of original data and y is the desired outcome
x y
1 1
1 2
1 3
1 4
1 5
0 0
1 1
1 2
1 3
1 4
Related Posts with cumulative sum that restarts at 0, if observe "0" in the original column.
Testing for structural break: Contradicting resultsI am analyzing prices data using ARIMA model. Stata's video clip availabel at https://www.youtube.co…
Durbin-Wu-Hausman test for GEEsDear Stata Forum I am running a GEE panel regression. I would like to check for endogeneity using …
Calculate and visualize horizontal distance between 2 (time series) linesHello, Is there a convenient way to calculate and visualize horizontal distance between 2 lines? See…
Dummy variablesI have to complete an assigment where I have to assign a dummy variable to 7 different classes. Thos…
Help with reshaping dataHi Statalist, I'm having trouble with reshaping my data. The data has a (self-explanatory) variable…
Subscribe to:
Post Comments (Atom)
0 Response to cumulative sum that restarts at 0, if observe "0" in the original column.
Post a Comment