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.
Very interesting.
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.
3. Yes - see https://www.phusewiki.org/docs/Conference%202016%20PP%20Papers/PP03.pdf
Hi @JeffMeyers and @Norman21 ,
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
Definitely useful.
Suggest you see similar:
https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3149-2019.pdf
https://blogs.sas.com/content/graphicallyspeaking/2016/10/20/outside-box-consort-diagram/
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.