Hi there,
I've come stuck with how to generate a dummy variable that indicates where a bank has changed clusters. As you can see from the snap off my sample, I have the institutionname, year, and cluster the bank belongs to each year.
I'd like to be able to generate a variable that indicates 0 if a bank hasn't changed cluster value (_clus_7) on the previous year, and 1 if it has. On the photo attached it would look like a 1 for observation 6 and 0 for everything else.
As you can seen, I've generated a variable 'changed' to indicate if the bank has changed at all at any point between 2010-2016 using this command:
by institutionname (_clus_7), sort: gen changed = (_clus_7[1] != _clus_7[_N])
but this isn't precise enough as I need to know what year that change occurred in to work if there is a significant change in banking practice after the EU's Banking Union was introduced.
Is it also possible to be even more precise and generate dummy variables with a value of 1 if a bank changed from cluster value of 1 to 4 say in a given year so I am able to track precisely which banks are going to which clusters from where?
Many thanks for your insight,
Olly
I've come stuck with how to generate a dummy variable that indicates where a bank has changed clusters. As you can see from the snap off my sample, I have the institutionname, year, and cluster the bank belongs to each year.
I'd like to be able to generate a variable that indicates 0 if a bank hasn't changed cluster value (_clus_7) on the previous year, and 1 if it has. On the photo attached it would look like a 1 for observation 6 and 0 for everything else.
As you can seen, I've generated a variable 'changed' to indicate if the bank has changed at all at any point between 2010-2016 using this command:
by institutionname (_clus_7), sort: gen changed = (_clus_7[1] != _clus_7[_N])
but this isn't precise enough as I need to know what year that change occurred in to work if there is a significant change in banking practice after the EU's Banking Union was introduced.
Is it also possible to be even more precise and generate dummy variables with a value of 1 if a bank changed from cluster value of 1 to 4 say in a given year so I am able to track precisely which banks are going to which clusters from where?
Many thanks for your insight,
Olly
Comment