Hi. I'm trying to use a sankey diagram to visualize and calculate a flow of patients between 5 different treatment centers.
Data data is structured as follows
ID TreatmentCenter Contact_number TransactionID
1 A 1 111
1 B 2 111
1 A 3 111
1 A 1 222
1 B 2 222
2 C 1 333
2 D 2 333
2 A 3 333
where ID is a uniqe identifier for each individual, TreatmentCenter is the place where the patient has been treated, Contact_number is the order of which treatments were carried out. If a new treatment episode i started for the same ID, contact_number is reset to 1 and transactionID is changed. TransactionID is used to group transactions.
For the Sankey diagram I use:
Event = TreatmentCenter
Sequence Order = Contact_number
Transaction Identifier = TransactionID
I want to use the diagram to see how patients flow between treatment centers and to calculate for example how many instances with contact number 2, treated in treatment center B, were treated before in in treatment center A. Somethinng like this:
Treatment Center A Contact number 2
Contact number 1 to Treatment center A
Treatment center B
Treatment center C
Treatment center D
Treatment center E
Treatment Center B Contact number 2
Contact number 1 to Treatment center A
Treatment center B
Treatment center C
Treatment center D
Treatment center E
The problem I run in to is that I have to much data, around 20 000 000 rows and the longest path is 2 800 contact numbers long. The most frequents paths are 1-5 contact numbers long.
Visual analytics will only show the top 300 most frequent paths. Data is thus missing. Is it possible to do this calculation in an other way or in some way get the sankey diagram to work? I don't have to see the longest paths, only have them in the "summation".
Kind regards
Hello and thanks for your question!
Someone else might have a better solution, but have you tried adding a filter on your TreatmentCenter data item?
For example, if your filter selects only treatment centers A and B, then that should dramatically reduce the number of rows and paths in the diagram, but you could still determine how often a patient at center B had been to center A before.
Also, you are probably already aware of this, but you can increase the number of paths selected in the Path Ranking field on the Properties tab.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.