Hello: I have a data set as below. I want to create a two-table that each cell has a value as percentage of changes in values. E.G. for variable "x1", it has values: a, b, c, d (in exact data, it has more values. so using loop for all values are desired). I want to get the percent of "a" changing to "b", "c", "d", and percent of remaining in "a" (based on the values of variable "x2"). The data: data test;
input x1 $1 x2 $1;
cards;
a a
a a
a b
a c
a d
b b
b a
b c
b d
c c
c c
c c
c a
d d
d a
d b
d b
;
run; So my goal is to get a table like: a b c d a 2/5 1/5 1/5 1/5 b 1/4 1/4 1/4 1/4 c 1/4 3/4 0 0 d 1/4 2/4 0 1/4 Any help is great! Thanks a lot!
... View more