I have a data file in the following format:
clear
input str2(firmid ownerid) float(own level type)
A B .4 1 1
A C .4 1 1
A D .2 1 1
B E .5 2 1
B F .5 2 1
E I .6 3 0
E J .4 3 0
F G 1 3 1
G I .6 4 0
G J .4 4 0
end
Where: firmid and ownerid represent the individual codes for a firm and its owner respectively. Own measures the ownership in %, level is the level of the pyramid, and type is 1 if the owner can be a firm or an owner, and 0 if the owner can not be owned, for example, a person.
I need to create to matrix from this data.
Let's say, matrix S (for the type 0 owners) and matrix T (for type 1 owners).
The output should be the following:
Matriz S | Matrix T | ||||||||
I | J | A | B | C | D | E | F | G | |
A | 0 | 0 | 0 | 0.4 | 0.4 | 0.2 | 0 | 0 | 0 |
B | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0.5 | 0 |
C | . | . | . | . | . | . | . | . | . |
D | . | . | . | . | . | . | . | . | . |
E | 0.6 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
F | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
G | 0.6 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Thank you and warm regards.
Luiz Ricardo
0 Response to Creating Two Matrices from a Data File
Post a Comment