One of my favorite things to do is to write macros to make tables/graphics/reports/etc. Some of my best ones can be found on this site (NEWSURV, MVMODELS, TABLEN, CIRCOS, DATA_SPECS, COMPARE_ALL), and a new one that I have been developing has focused on making a Consort diagram. In the past I've had to use software like Word, Visio, and PowerPoint to make these diagrams as I hadn't found a way to do it programmatically. I've seen cases where an RTF document somehow has numbers filled in to an existing chart, but didn't like that approach.
My macro focuses on using TEXT plots to make the text boxes and then connects them with line statements based on the anchors of the text boxes. Here is an example of one that I made with my current macro:
The macro call that I needed to use to make this was:
%consort(data=for_consort,id=subject, node=screened randomized treated ntrt4 ntrt8 ntrtv2 surg adj compadj, split=* arm, offreason=scrnrsn endatrsn endrsn2)
The options stand for:
The macro calculates the x/y coordinates of the boxes as well as the lines that connect them before drawing. There are also methods within the macro to manually make the dataset for more complicated consorts.
My questions are:
Any feedback or suggestions are appreciated! I've been rather excited by the challenge of making this program.
1. Yes, this looks useful. As a suggestion, try and make output look like the following: http://www.consort-statement.org/consort-statement/flow-diagram
2. It would be useful to have a check on the numbers to ensure they add up correctly. For example, started adjuvant treatment n=22 minus off treatment n=3 should equal completed adjuvant treatment n=19. Also, it would be good to have output options e.g. PDF or RTF.
It's a great effort of Jeffrey to try an automated solution for this very difficult task, and the outcome so far is very helpful and promising. I agree with Norman21 on 1) and 2). 3. has a bad link, and it probably refers to a Prashant Hebbar's paper, and here is one: https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3149-2019.pdf .
Hebba's work was amazing but not general enough and it's not about to automate this process.
Shane Rosanbalm' work, of Rho Inc., https://www.lexjansen.com/pharmasug/2019/DV/PharmaSUG-2019-DV-021.pdf, is very closed to automate the process, he wrote 3 macros to handle the boxes, links and text positions and they are quite general.
Ryan Yu, of Regeneron, published a paper to claim he automated the process, using Shane's macros, https://www.lexjansen.com/pharmasug/2021/DV/PharmaSUG-2021-DV-082.pdf, but we haven't see the code yet.
Besides 1. and 2 from Norman21, Figure 3 in this link: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2222221/pdf/1745-6215-8-36.pdf is a little bit challenge for Jeffrey to try.
I have explored a different method to draw a CONSORT diagram. See the attached. It uses Microsoft Word/RTF's Shapes, boxes and arrows here and only SAS data _null_ was used in the generation of the file. The outcome is an RTF file, but it's totally not what in Art Carpenter's head when he talked about using RTF file to automation of CONSORT diagram: https://www.lexjansen.com/pharmasug/2012/TF/PharmaSUG-2012-TF16.pdf
Suggest you see similar:
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.