Hi

I want to measure how many patients which, in period T, were in one of the levels of disease moved, in the next period, to any of the other levels.I mean I want to know how much of patients in levelX are in latter period in a different level and aggregate all the changes together.
my goal is generating this relative changes in a table which has 3 columns and 3 rows: level1 level2 level3 (as rows and also columns too), and each cell is the percent of changing from each level to another one in whole periods
my dataset is similar to:
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(PatientID level1 level2 level3 period)
100010 1 . . 1
100020 . 1 . 1
100022 1 . . 1
100032 . . 1 1
100010 . 1 . 2
100022 . . 1 2
100020 . . 1 2
end
Thanks