Dear All, I have the following data
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte id str3 rating1 str1 inst1 str3 rating2 str1 inst2
1 "AA+" "A" "AA+" "B"
2 "AA"  "C" "AAA" "B"
3 "AAA" "B" "AA"  "C"
4 "AAA" "C" "AA+" "B"
5 "AAA" "B" "AAA" "A"
6 "AA"
where `rating1' is the credit rating given by the institution 1 (`inst1'), and `rating2' is the credit rating given by the institution 2 (`inst2'). I all cases, there are two institutions. B institution is always included, along with another institution (say , A or C).
My question is that: How can I obtain a variable (say `i1') with all B institution along with its credit rating (say, a new variable `r1'). Similarly, another variable (say, `i2', containing the other institution) contains their ratings in `r2'? Thanks.