I am working with panel data and investigating how employees experience the transfer from a private employer to a public employer (i.e., insourcing) in terms of, e.g., salary. The employees are from 20+ distinct and independent cases of insourcing.
I have identified a date for each case of insourcing (i.e., the transfer of employees from a private company to a public company). Now, I would like to standardize time, so I can investigate the cases jointly.
I have made an example dataset (I have included the desired variable in the example dataset (but it is generated manually).
Code:
clear input byte id float time byte(treatment treatment1) int time1 byte treatment2 int time2 byte treatment3 int(time3 desired_variable) 1 588 . . . . . . . 985 1 589 . . . . . . . 986 1 590 . . . . . . . 987 1 591 . . . . . . . 988 1 592 . . . . . . . 989 1 593 . . . . . . . 990 1 594 . . . . . . . 991 1 595 . . . . . . . 992 1 596 . . . . . . . 993 1 597 . . . . . . . 994 1 598 . . . . . . . 995 1 599 . . . . . . . 996 1 600 . . . . . . . 997 1 601 . . . . . . . 998 1 602 . . . . . . . 999 1 603 1 1 1000 . . . . 1000 1 604 . . . . . . . 1001 1 605 . . . . . . . 1002 1 606 . . . . . . . 1003 1 607 . . . . . . . 1004 1 608 . . . . . . . 1005 1 608 . . . . . . . 1006 1 610 . . . . . . . 1007 1 611 . . . . . . . 1008 1 612 . . . . . . . 1009 1 613 . . . . . . . 1010 1 614 . . . . . . . 1011 1 615 . . . . . . . 1012 1 616 . . . . . . . 1013 1 617 . . . . . . . 1014 1 618 . . . . . . . 1015 1 619 . . . . . . . 1016 1 620 . . . . . . . 1017 1 621 . . . . . . . 1018 1 622 . . . . . . . 1019 1 623 . . . . . . . 1020 2 588 . . . . . . . 980 2 589 . . . . . . . 981 2 590 . . . . . . . 982 2 591 . . . . . . . 983 2 592 . . . . . . . 984 2 593 . . . . . . . 985 2 594 . . . . . . . 986 2 595 . . . . . . . 987 2 596 . . . . . . . 988 2 597 . . . . . . . 989 2 598 . . . . . . . 990 2 599 . . . . . . . 991 2 600 . . . . . . . 992 2 601 . . . . . . . 993 2 602 . . . . . . . 994 2 603 . . . . . . . 995 2 604 . . . . . . . 996 2 605 . . . . . . . 997 2 606 . . . . . . . 998 2 607 . . . . . . . 999 2 608 1 . . 1 1000 . . 1000 2 609 . . . . . . . 1001 2 610 . . . . . . . 1002 2 611 . . . . . . . 1003 2 612 . . . . . . . 1004 2 613 . . . . . . . 1005 2 614 . . . . . . . 1006 2 615 . . . . . . . 1007 2 616 . . . . . . . 1008 2 617 . . . . . . . 1009 2 618 . . . . . . . 1010 2 619 . . . . . . . 1011 2 620 . . . . . . . 1012 2 621 . . . . . . . 1013 2 622 . . . . . . . 1014 2 623 . . . . . . . 1015 3 588 . . . . . . . 978 3 589 . . . . . . . 979 3 590 . . . . . . . 980 3 591 . . . . . . . 981 3 592 . . . . . . . 982 3 593 . . . . . . . 983 3 594 . . . . . . . 984 3 595 . . . . . . . 985 3 596 . . . . . . . 986 3 597 . . . . . . . 987 3 598 . . . . . . . 988 3 599 . . . . . . . 989 3 600 . . . . . . . 990 3 601 . . . . . . . 991 3 602 . . . . . . . 992 3 603 . . . . . . . 993 3 604 . . . . . . . 994 3 605 . . . . . . . 995 3 606 . . . . . . . 996 3 607 . . . . . . . 997 3 608 . . . . . . . 998 3 609 . . . . . . . 999 3 610 1 . . . . 1 1000 1000 3 611 . . . . . . . 1001 3 612 . . . . . . . 1002 3 613 . . . . . . . 1003 3 614 . . . . . . . 1004 3 615 . . . . . . . 1005 end format %tm time
I would like a variable that counts backward and forward from the occurrence of the treatment. This would provide standardized time periods equal across the different cases. My goal is to use this in a regression, such as
Code:
xtreg salary i.treatment##i.time_standardized x1 x2 x3, fe
Gustav
0 Response to Standardization of time in panel data with different treatments
Post a Comment