4月 162019

This blog post is based on the Code Snippets tutorial video in the free SAS® Viya® Enablement course from SAS Education. Keep reading to learn more about code snippets or check out the video to follow along with the tutorial in real-time.

Has there ever been a block of code that you use so infrequently that you always seem to forget the options that you need? Conversely, has there ever been a block of code that you use so frequently that you grow tired of typing it all the time? Code snippets can greatly assist with both of these scenarios. In this blog post, we discuss using pre-installed code snippets and creating new code snippets within SAS Viya.

Pre-installed code snippets

Figure 1: Pre-installed Snippets

SAS Viya comes with several code snippets pre-installed, including snippets to connect to CAS. To access these snippets, expand the Snippets area on the left navigation panel of SAS Studio as shown in Figure 1. You can see that the snippets are divided into categories, making it easier to find them.

If you double-click a pre-installed code snippet, or if you click and drag the snippet into the code editor panel, then the snippet will appear in the panel.

Snippets can range from very simple to very complex. Some contain comments. Some contain macro variables. Some might be only a couple of lines of code. That is the advantage of snippets. They can be anything that you want them to be.



Create new snippets

Now, let’s create a snippet of our own. Figure 2 shows an example of code that calls PROC CARDINALITY. This code is complete and fully executable. When you have the code the way that you want in your code window, click on the shortcut button for Add to My Snippets above the code. The button is outlined in a box in Figure 2.

Figure 2: Add to My Snippets Button

A window will appear that asks you to name the snippet. Naming the snippet then saves it into the My Snippets area in the left navigation panel for future use.

Remember that snippets are extremely flexible. The code that you save does not have to be fully executable. Instead of supplying the data source in your code, you may instead include notes or comments about what needs to be added, which makes the code more general, but it is still a very useful snippet.

To use one of your saved snippets, simply navigate to the My Snippets area, then double-click on your snippet or drag it into the code window.

Want to learn more about SAS Viya? Download the free e-book Exploring SAS® Viya®: Programming and Data Management. The content in this e-book is based on SAS® Viya® Enablement," a free course available from SAS Education.

Using code snippets in SAS® Viya® was published on SAS Users.

3月 312017

If you're into data visualization, here's something that might interest you - a free eBook showing several ways to use SAS to visually analyze your data. (Did I mention it's FREE?!?!) We've picked juicy chapters from several books and upcoming books (and a few other sources), to show you what [...]

The post How about a free eBook on data visualization using SAS! appeared first on SAS Learning Post.

6月 262014
Go USA! Go Germany! Go Mexico! Go Colombia! Wish you were still in it, England! That’s right, it’s World Cup time, and due to the international flavor of my family, I’ve got a number of teams I’m rooting for. I played a little soccer (or “futbol” in our house) back […]
3月 142013
SAS Publications has been working hard to convert our most popular titles to eBooks. We believe that eBooks are particularly important for our customers outside the US because of shipping costs, import fees, and the time it takes for you to obtain your books. Benefits to reading eBooks: eBooks are [...]
9月 202012
You may have received the announcement that Carpenter’s Guide to Innovative SAS Techniques has just released as an eBook through the Apple iBookstore. Over the years, we’ve received feedback from SAS users that they would like more flexibility in how they purchase their SAS Press content. With Art’s book, we’re [...]
6月 012012
Stop at any fast food restaurant in America, and no matter what you order, you’ll likely be asked, “Would you like fries with that?” Fries are the traditional accompaniment to any fast food entrée. More recently, fast food restaurants have begun to broaden their menu and offer healthier choices in [...]
5月 012012
The question above is posed in the SAS eBook The Transformation of the Banking Industry: a brave new world. The financial services industry is still the largest chunk of our sales, clocking in at over 40% globally. We like to talk to our customers a lot and share their stories. [...]
4月 052012

This picture (by newsobserver.com) took from Wake County Library Book Fair in North Carolina Fairground where I also went to pick up some books.

I was and still is a big book (almost paper books) fan. But when I was standing among the 450,000 used books in the book fair, I felt depressed and reluctantly had an impression: the paper  books will and should go away in the future.  eBooks will not fade away and they also have the economical, ecological and even aesthetical advantages.

Books are good(hundred and thousand years ago, our ancestors read books in silk, bamboo, shell, stone, . . .), new paper books are good too. But the massive used books are burdens. I like the smell of ink of paper books but only for the new. The 450, 000 used books only have some recycling values: you can get a bag of books only for only 1 buck in the last exhibition day!

Digital Life and Personal Data Analysis

eBook is one part of our digital library. We also have eMails, eBills, Tweets . . . and these data are born for analysis: complete, accurate, well formatted while in time(again, analytical advantage!).


Stephen Wolfram, the founder and CEO of Wolfram Research, posted an analysis of his personal emails as above. That’s cool and you might know that years ago a writer would transcribe at least two copies of his/her mail, one for sending out and another for archiving (and publishing).

Liza Lucas of SAS JMP R&D also contributed a page on her graphical financial life while the data come from a online personal financial management system:

Back to reading. Below is my daily readings via Google Reader (in laptop and phone) in the past 30 days:


Haa, I should clean up my subscribes now.