I have a dataset of individuals that can be lenders and borrowers. A simple example of my data set is as follows:
Here, the variable lending =1 if the individidual is a lender. I want to create 12 new variables (each individual as a lender or a borrower), that takes on a value of 1 if the individual is a lender in the observation being considered (and 0 for all other observations). I have been trying different variations of the forval command, to no avail. Any help is much appreciated.
Code:
i Lending 1 1 2 0 3 1 4 1 5 0 6 1 1 0 2 1 3 0 4 1 5 0 6 1 end
Here, the variable lending =1 if the individidual is a lender. I want to create 12 new variables (each individual as a lender or a borrower), that takes on a value of 1 if the individual is a lender in the observation being considered (and 0 for all other observations). I have been trying different variations of the forval command, to no avail. Any help is much appreciated.