Hello Statalist!
I hope this question will present a nice challenge to the experts on here. I really cannot get my head around how to do it.
I have panel data that is on several levels. I have firm-level data on South American firms (e.g., number of employees). I have bank-level data on South American banks (e.g., equity). I have account-level data that defines a relationship between the firm and the bank (e.g., credit balance). There are approximately 10,000 firms, 100 banks and 40,000 accounts. The data spans the years 2009-11. I have reshaped the data to wide format, such that my data looks something like this (this is just an example of a few variables with some made up numbers and identifiers):
I am interested in identifying an account --- i.e. a Firm_ID*Bank_ID combination -- such that the credit balance falls from 2009 to 2011 and the credit balance on another account increases by at least the same amount over the same period (i.e., the firms makes up for the lost borrowing from one bank by borrowing from another bank), or the balance across all the other accounts increases by at least the same amount (i.e., the firm makes up for the lost borrowing by increasing borrowing across all other accounts). In the example above, I would identify the following Firm_ID*Bank_ID combinations: 1*1, 2*1 and 2*4. I'd like an indicator (dummy) variable for these accounts.
I really can't figure out how to do this. I can create indicators for a credit balance falling or increasing, but it gets very tricky when it happens twice for a given firm.
If anyone can help, it would really be appreciated.
Adam Gannon
I hope this question will present a nice challenge to the experts on here. I really cannot get my head around how to do it.
I have panel data that is on several levels. I have firm-level data on South American firms (e.g., number of employees). I have bank-level data on South American banks (e.g., equity). I have account-level data that defines a relationship between the firm and the bank (e.g., credit balance). There are approximately 10,000 firms, 100 banks and 40,000 accounts. The data spans the years 2009-11. I have reshaped the data to wide format, such that my data looks something like this (this is just an example of a few variables with some made up numbers and identifiers):
Firm_ID | Bank_ID | Credit09 | Credit10 | Credit11 | Firm_employees09 | Bank_equity09 |
1 | 1 | 1000 | 1250 | 600 | 30 | 100 |
1 | 2 | 0 | 400 | 700 | 30 | 200 |
1 | 3 | 0 | 0 | 400 | 30 | 150 |
2 | 1 | 1500 | 1000 | 500 | 100 | 100 |
2 | 2 | 900 | 700 | 800 | 100 | 200 |
2 | 4 | 1200 | 1200 | 400 | 100 | 300 |
2 | 5 | 0 | 0 | 1000 | 100 | 180 |
I am interested in identifying an account --- i.e. a Firm_ID*Bank_ID combination -- such that the credit balance falls from 2009 to 2011 and the credit balance on another account increases by at least the same amount over the same period (i.e., the firms makes up for the lost borrowing from one bank by borrowing from another bank), or the balance across all the other accounts increases by at least the same amount (i.e., the firm makes up for the lost borrowing by increasing borrowing across all other accounts). In the example above, I would identify the following Firm_ID*Bank_ID combinations: 1*1, 2*1 and 2*4. I'd like an indicator (dummy) variable for these accounts.
I really can't figure out how to do this. I can create indicators for a credit balance falling or increasing, but it gets very tricky when it happens twice for a given firm.
If anyone can help, it would really be appreciated.
Adam Gannon