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
Analyzing the dataDear all. I am required to analyze the data on a project that requires answering the question: Why i…
Using nlcom and lincom after marginsI have been attempting to compare the two items in a margins output table (calculated at a specific …
Sargan or HansenIs it possible to use hansen test after xtabond? I estimated my model with xtabond....vce(robust) an…
Simple wrapper for set traceI am attempting to write wrapper programs that allow me to type ston and stoff instead of set trace …
Legend option in Graph barDear All, I want to make a graph bar over a categorical variable (4 categories). My data looks as f…
Subscribe to:
Post Comments (Atom)
0 Response to Help needed to create a (potentially simple) variable
Post a Comment