I would like to delete rows in my panel data based on a condition.
The rows with missing revenue should be deleted only if revenue is not present in year 1.
If the revenue is not present in year 1 then delete the next rows if revenue is not present.
Before :
firm_id | year | Revenue |
1 | 1 | 0 |
1 | 2 | 0 |
1 | 3 | 0 |
1 | 4 | 1000000 |
1 | 5 | 0 |
1 | 6 | 1500000 |
firm_id | year | Revenue |
1 | 4 | 1000000 |
1 | 5 | 0 |
1 | 6 | 1500000 |
0 Response to Delete rows based on condition (panel data)
Post a Comment