Hi,
I need to create a variable that essentially sums the number of 1s each participant has accumulated so far. The variable I need to create is I2. On the left of the image is an example of some data but with the I2 column blank, on the right is the I2 column filled in with the correct values. In STATA, how would I create variable I2.
So for example, with participant 14973 at the first date they had a 0 in I1, therefore I2 = 0. At the next date, that participant had a 1 in I1, therefore I2 = 1. At the next date, that participant had a 0 in I1, therefore I2 = 1 (this is because I2 is a running total of how many 1's in I1 that the participant has accumulated so far). etc.
I would like to know how to create that variable in STATA, and I have so many participants that it will be impossible to do this individually for each person.
Please any help would be greatly appreciated!
Many thanks!
[ATTACH=CONFIG]temp_17774_1587212011051_342[/ATTACH]
Related Posts with Help needed to create a (potentially simple) variable
spmap command produces only a fraction of the intended mapHello! I'm trying to draw a map that shows proportion of households in a state that report a migrant…
Variable information in table notes using estout/esttabHi, I am trying to format a series of regression tables with estout/esttab. My regressions all have…
Coefficient Matrix in Unconditional Quantile RegressionsI am running models with the ivqte command, which estimates unconditional quantile regressions, as d…
bctobit LM testgood evening stata users i am using tobit model and after running the model to test for normality an…
t(100) specificationI have received the following request from one of our clients: PDF codebooks Please use the t(100)…
Subscribe to:
Post Comments (Atom)
0 Response to Help needed to create a (potentially simple) variable
Post a Comment