BookmarkSubscribeRSS Feed

Jupyter Notebook: Your Coding Canvas Q&A, Slides, and On-Demand Recording

Started ‎07-29-2024 by
Modified ‎07-29-2024 by
Views 1,136

Watch this Ask the Expert session to learn how to use the power and flexibility of Jupyter Notebook within the SAS® Viya® environment.

Watch the Webinar

 

You will learn: 

  • The fundamentals of Jupyter Notebook and how it’s integrated within SAS Viya. 
  • Practical tips and tricks to enhance your coding efficiency and organization. 
  • Insights into using Jupyter Notebook for SAS, Python and R. 
  • The confidence and skills to create beautiful, functional programs. 

The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached. 

 

Q&A 

Are there any advantages to using Jupyter notebooks from an IDE like MS VSCODE instead of the standard version? 

There will always be advantages when integrating Jupyter Notebooks with another product, like VS Code, because you can benefit from the features of both technologies combined. Personally, I’ve almost exclusively used JupyterHub through SAS Viya because the kernels I need are already included, and I’m able to keep my data and analysis in the single environment. The same could be true for using VS Code and utilizing the built-in features available to make your data analysis more streamlined and central. 

 

Can we program mix of SAS, R and Python in one .ipynb file instead of 3 separate files for SAS, R and Python? 

Absolutely! One of the standout features of Jupyter Hub is the use of cell magic and line magic commands. These commands allow you to modify the kernel for specific cells. For instance, using ‘%%python3’ lets you switch the kernel for that particular cell to Python 3, which can be incredibly useful during analysis. If you realize mid-analysis that you need a different language for a specific task, you can easily switch within that cell. There are hundreds of cell and line magics available, enabling functionalities like integrating matplotlib for plotting or debugging directly within your notebook. This flexibility to change languages and incorporate various tools within a single notebook is one of my favorite features. 

 

Can you see your SAS log in Jupyter NB as well as code %2B results? 

Yes, it’s all part of our inline output. When using the SAS kernel in Jupyter Notebooks, you’re working within a streamlined view where you can write and execute SAS code, view the output, and examine the log. Rather than navigating to different tabs for log, results, and output, you simply scroll down! 

 

Can we install Julia, Teradata SQL Kernel too in this environment?  

Yes, you can install Julia, Teradata, and SQL kernels in Jupyter Notebooks. Jupyter supports multiple programming languages through various kernels, allowing you to work with different languages and databases within the same environment. To add additional language or databases, there are a few quick steps to import and load the kernels. 

 

 Can we access Jupyter without SAS Viya? 

Yes, you can access Jupyter without SAS Viya. Jupyter is a standalone technology that can be used independently of SAS Viya. However, at SAS, we recognize the incredible capabilities of Jupyter, which is why we've integrated it into our SAS Viya offerings. This integration allows users to leverage the powerful analytics of SAS alongside the interactive and flexible environment of Jupyter, providing the best of both worlds. 

 

What if you're delivering reports to a group of non-programmers who are only interested in the results, and not in the intermingled code? Is there a way to pull out or somehow isolate the reports so they don't have to wade through the code to find what they need? 

Absolutely! There are several options to tailor the view in Jupyter Notebooks for non-programmers interested only in the results: 

  • Collapsing Code: You can collapse code cells to hide the code and display only the outputs. This makes it easier for users to focus on the results without being distracted by the underlying code. 
  • Running and Exporting: You can run all the code and then export the notebook in a format that hides the code, such as HTML or PDF. This way, the recipients see only the outputs. 

These features ensure that non-programmers can access the information they need without having to navigate through the code. 

 

Could you please provide the Docker image or source where we can get this Jupyter Hub? 

First, anyone can access JupyterHub since it’s an open-source project, and Docker is a great way to deploy it. However, offering Jupyter integrated with SAS Viya is outside my division. In the demo, I use SAS Viya for Learners, which is provided to students and faculty for free to enable teaching and learning of SAS technology. If you find yourself with a JupyterHub that includes the SAS, R, and Python kernels, please check out the notebooks from the demo on GitHub: https://github.com/lincolngroves/We-Are-All-Friends.git 

 

How do I learn the markdown syntax for JupyterLab? 

To learn Markdown syntax for JupyterLab, the Help menu is incredibly useful. Here's how you can use it: 

  1. Help Menu: Click on the Help button in the top bar. This will provide access to various resources, including a Markdown reference. 
  2. Markdown Reference: The Markdown reference offers a quick guide and tutorials on using Markdown. It covers basics like headers, bold text, lists, tables, and links. 
  3. LaTeX Integration: The reference also explains how to use LaTeX for adding Greek symbols and mathematical expressions. 

Using these resources, you'll quickly get up to speed with Markdown in JupyterLab. 

 

Do I need a GitHub account to access others' files? 

No, you don't need a GitHub account to access and explore others' files. GitHub allows anyone to view and download public repositories. You can pull these files into your JupyterHub interface without an account. However, if you want to push changes or contribute to repositories, you'll need an account for tracking edits and maintaining version control. 

 

Can you run a Jupyter notebook file as batch from SAS 9, or quick way to export all the SAS code only? 

Unfortunately, there is not an easy or automated way to run a Jupyter Notebook file in batch from SAS 9 or to export only the SAS code. Both would involve converting the file to a script or markdown format and then either making code modifications for the batch job or using code to extract only the SAS code. 

 

Recommended Resources 

Using SAS® Viya® REST APIs with Python and R 

Please see additional resources in the attached slide deck. 

 

Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars. 

 

 

Version history
Last update:
‎07-29-2024 11:29 AM
Updated by:

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Article Labels
Article Tags