There are many JavaScript libraries a SAS user can use to create beautiful interactive charts quickly. I wrote a paper a while back in doing this using D3. Now I have created a GitHub repository with various SAS macros I have for creating charts in HTML if anyone wants to use them. Currently, this has only macros for Google Charts but I will be adding various D3 and other JS visualization macros.
Have fun visualizing at will!
That looks awesome! Well done. Is there a way to add multiple graphs to the same HTML file and/or adding text in between?
EDIT: some don't work, like the timeline one. Also, just a heads up, you can read your code directly from GitHub, you don't need to have the code locally as well in myfolders. It'll make your GitHub code, copy/paste/run rather than having to worry about downloading the macro files. This way, we can ensure we're using the latest version of your code without manually maintaining links 😉
%let source_path = https://gist.githubusercontent.com/statgeek/bcc55940dd825a13b9c8ca40a904cba9/raw/865d2cf18f5150b8e887218dde0fc3951d0ff15b/data2datastep.sas;
filename reprex url "&source_path";
%include reprex;
filename reprex;
You can use HTML iframes to combine multiple charts into a single view or a set of slides after having created each one. I will be creating an example showing how to do it.
Good tip on directly reading the macro from GitHub. For anyone who wants to take that route, the code is
filename hzggmacr url "https://raw.githubusercontent.com/haziris/haziris-sas/master/macros/haziris_google.sas"; %include hzggmacr;
Which timeline example isn't working? I had typos on a few of the example links and had fixed them.
Thanks!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.