Cohort | Period 1 (x1) | Period 2 (x2) | Period 3 (x3) |
2010 | % | % | % |
2013 | % | % | % |
2016 | % | % | % |
Briefly, I think I need a “period” variable (I have it but divided in three variables x1 x2 x3) with one observation for each period. The huge problem is that there are individuals (id 64 and 79) for which the same observation implies two or three different values (period). Therefore, I do not have a single variable for which each observation is one of these periods.
So, I do not know how to solve this issue. I assume that maybe one solution would be to add two or three more observations only for those id presenting more than one value –x1 x2 x3—in the same observation (as it is now). But I do not know how to do it, or even if this would allow me to buid a table like the one above.
Is there someone that could help me with this?
Thanks in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(id1 start_date end_date cohort x1 x2 x3) 31 13661 13752 2013 . . . 31 14407 14499 2013 . . . 31 14778 14870 2013 . . . 31 15147 15234 2013 . . . 31 15240 . 2013 . . . 31 15536 15583 2013 . . . 31 15902 . 2013 . . . 31 17706 . 2013 . . . 31 20383 21206 2013 2 . . 31 21207 21556 2013 . 2 . 31 21397 21950 2013 . . . 57 16020 . 2013 . . . 57 16363 . 2013 . . . 57 16626 16646 2013 . . . 57 16990 17018 2013 . . . 57 17426 17791 2013 . . . 57 17806 18170 2013 . . . 57 18170 . 2013 . . . 57 18814 18997 2013 . . . 57 19057 19258 2013 . . . 57 19283 19374 2013 . . . 57 19557 19740 2013 . . . 57 20975 21066 2013 . . . 57 21001 21950 2013 . 2 . 64 15342 16071 2010 . . . 64 16071 . 2010 . . . 64 18093 18457 2010 . . . 64 18444 18686 2010 . . . 64 18687 19051 2010 . . . 64 19051 19548 2010 1 . . 64 19549 21950 2010 . 1 1 79 14062 . 2010 . . . 79 14515 . 2010 . . . 79 15331 15341 2010 . . . 79 16118 . 2010 . . . 79 16252 . 2010 . . . 79 16265 . 2010 . . . 79 16266 . 2010 . . . 79 16267 . 2010 . . . 79 16286 . 2010 . . . 79 16649 . 2010 . . . 79 16680 . 2010 . . . 79 17198 17928 2010 . . . 79 18434 21950 2010 1 1 1 end format %td start_date format %td end_date
0 Response to create a three way table
Post a Comment