Dear helpers
I couldn't get a good code to count the number of continuous 1s for each ID; something like
0 0 4 4 4 4 0 1 in 2013-2020 for the 1st id
2 2 0 0 0 2 2 in 2014-2020 for the 2nd id
Please help.
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
I couldn't get a good code to count the number of continuous 1s for each ID; something like
0 0 4 4 4 4 0 1 in 2013-2020 for the 1st id
2 2 0 0 0 2 2 in 2014-2020 for the 2nd id
Please help.
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int id float(yr x) 1001 2013 0 1001 2014 0 1001 2015 1 1001 2016 1 1001 2017 1 1001 2018 1 1001 2019 0 1001 2020 1 1002 2014 1 1002 2015 1 1002 2016 0 1002 2017 0 1002 2018 0 1002 2019 1 1002 2020 1 end
Comment