I am new to using STATA and I have searche dthe forum but could not find an answer yet - this is why I try to make a post here.
I am working with panel data and I need to create a new variable.
Please see this example:
institute | personid | year | position | timeamount | NEWVARIABLE |
1 | 8741 | 2019 | A | 10 | 8 |
1 | 33885 | 2019 | B | 8 | 8 |
1 | 8741 | 2020 | A | 11 | 9 |
1 | 33885 | 2020 | B | 9 | 9 |
2 | 14221 | 2019 | A | 7 | 3 |
2 | 33126 | 2019 | B | 3 | 3 |
2 | 14221 | 2020 | A | 8 | 4 |
2 | 33126 | 2020 | B | 4 | 4 |
After I have created the new variable I will collapse the dataset so I only have one row per institute and year with the new variable value.
I am not sure how I can generate this new variable.
Can anyone help me out here? Would be greatly appreciated.
Thank you so much in advance!!
I am using STATA verison 14.2
Kind regards,
Elaine
0 Response to Creating a new variable in paneldata
Post a Comment