BookmarkSubscribeRSS Feed

Sharing SAS Notebooks on GitHub

Started ‎10-26-2025 by
Modified ‎10-26-2025 by
Views 291

SAS notebooks are a popular and powerful way to share SAS programs, logs, and results within a single interactive document. They use a cell-oriented execution model, where code, logs, and results are stored together inline in each cell, reflecting the chronological order of execution.

 

01_nir_post_106_01_sas_notebook.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

SAS notebooks can be created and edited in VS Code using the SAS extension. They are often paired with Git repositories, such as GitHub, since VS Code provides seamless integration with Git.

 

02_nir_post_106_02_vs_code_sas_notebook.png

 

 

The problem

 

SAS notebooks haven’t (yet!) gained the same history or recognition as Jupyter Notebooks. When you open one on GitHub in your browser, here’s what you’ll see:

 

03_nir_post_106_03_github_sas_notebook_issue-1024x415.png

 

Not super helpful, right?

 

The problem is that SAS notebooks don’t display nicely in Git tools. You just get the raw JSON source — not exactly readable.

 

Sure, you can tell someone to install VS Code, clone the repo, and open it there, but that’s hardly a smooth experience.

 

 

Exporting to HTML

 

You might think, “Why not just export the SAS notebook to HTML?”

That’s actually possible now with recent versions of the SAS extension for VS Code. Once exported, you can upload the HTML file to GitHub just like any other file.

 

04_nir_post_106_04_export_sas_nb_html.png

 

When exporting, there’s an interesting option to include the SAS log in the HTML output. Make sure to check that box if you want the log to appear alongside your notebook content.

 

05_nir_post_106_05_export_log_option.png

 

Now that the HTML file is on GitHub — how does it look?

 

06_nir_post_106_06_github_html_issue.png

 

Not great, right?

 

Unfortunately, GitHub.com doesn’t render HTML files as live web pages. For security reasons, clicking an .html file in a repository only shows the raw HTML source, not the rendered version.

 

So… we’re not much better off than before.

 

 

The solution

 

While you can use htmlpreview.github.io to view your HTML files in a browser, it’s not the most straightforward solution. A better approach is GitHub Pages.

 

GitHub Pages is a free hosting service that allows you to publish static websites — including HTML, CSS, and JavaScript — directly from a GitHub repository.

 

It works for personal public repositories and any public repositories where you have admin or maintainer permissions. With the right GitHub Enterprise plan, it can also be enabled for private enterprise repositories.

 

To enable GitHub Pages on your repository, start by going to Settings > Pages. Keep the default option, “Deploy from a branch,” then select the branch you want to publish and the folder to serve — the root folder (/) is the default. Click Save to confirm.

 

07_nir_post_106_07_github_pages_setup-1024x626.png

 

Once configured, you can monitor the deployment by going to Actions, where the GitHub Pages job will progress from Queued to In progress and finally Completed.

 

08_nir_post_106_08_github_actions_monitor-1024x433.png

 

The process usually takes just a few minutes, depending on the number of files in your repository.

 

After the job finishes, return to Settings > Pages to find the URL of your published site. Click Visit site.

 

09_nir_post_106_09_github_visit_site.png

 

From there, simply append the path to your HTML file to view it in the browser. You might also consider creating an index page to make it easier to navigate between all your exported SAS notebook HTML files.

 

10_nir_post_106_10_github_page_html.png

 

Any updates you push to the selected branch will automatically trigger a rebuild, keeping your GitHub Pages site up to date.

 

If you don’t want to publish the entire repository, you can restrict GitHub Pages to a subfolder, typically named /docs. For example, place your SAS notebooks exported as HTML in a /docs folder at the root of the repository, then configure GitHub Pages to serve only that folder. This way, only the HTML files you want to share are published, while the rest of your repository remains private.

 

11_nir_post_106_11_github_pages_docs_setup.png

 

With GitHub Pages, you can turn your exported SAS notebooks into a live, browsable website without extra tools. Organize your HTML files in a folder, add an index page if you like, and your site stays automatically up to date — a simple way to share your analyses with anyone. If you’ve found a better approach, I’d love to hear about it, so please share!

 

Thanks for reading.

 

 

Find more articles from SAS Global Enablement and Learning here.

Comments

@NicolasRobert 

Have you tried to use GitHub integrated VS Code from within the Browser?

To open a GitHub repository directly in VS Code for the Web, simply use URL shortcuts by changing the domain in the repository’s link.

GitHub.dev Shortcut

Vscode.dev Shortcut

Contributors
Version history
Last update:
‎10-26-2025 06:49 PM
Updated by:

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags