Dear fellow Stata users,
I am working with an unbalanced panel dataset, with companies’ id and monthly dates.
I would like to expand my dataset in a way such that: the key variable is continued until the next observation recorded or throughout the following 12 months, if the next observation I have is after 12 months. And, when there are no more entries for a company, I would like to continue the variable also for the next 12 months.
For example, if for one company I have these (and only these) values,
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int id float date byte keyvar 10001 663 0 10001 672 4 10001 701 2 end format %tm date
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int id float date byte keyvar 10001 663 0 10001 664 0 10001 665 0 10001 666 0 10001 667 0 10001 668 0 10001 669 0 10001 670 0 10001 671 0 10001 672 4 10001 673 4 10001 674 4 10001 675 4 10001 676 4 10001 677 4 10001 678 4 10001 679 4 10001 680 4 10001 681 4 10001 682 4 10001 683 4 10001 684 4 10001 701 2 10001 702 2 10001 703 2 10001 704 2 10001 705 2 10001 706 2 10001 707 2 10001 708 2 10001 709 2 10001 710 2 10001 711 2 10001 712 2 10001 713 2 end format %tm date
Thanks in advance.
Kindly,
Miguel
Comment