Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73395

Generating new variables based on all values of an existing variable and another condition

$
0
0
I have a dataset of individuals that can be lenders and borrowers. A simple example of my data set is as follows:

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.

Viewing all articles
Browse latest Browse all 73395

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>