Have you created Scalable Vector Graphics with SAS?

SAS Technical Support Problem SolversIf you haven’t tried them for your web applications and other graphics needs, you’ll want to read further!

Scalable Vector Graphics (SVG) output is vector graphics output you can display with most (if not all) modern web browsers. Because SVG graphic output is scalable, you can zoom in on the graphics output without losing resolution. Unlike bit-mapped images such as PNG or GIF output, they can be resized or transformed without compromising the clarity, eliminating the need to produce multiple versions of the same image! There are other advantages for using Scalable Vector Graphics like their ability to zoom in to view details, their smaller output file size and their usefulness for producing graphics for a range of display sizes and types.

Which SAS products offer SVG graphics?

The SVG family of device drivers has shipped as part of the SAS/GRAPH product since the SAS 9.2 release. Note that you can only use these SVG device drivers with traditional SAS/GRAPH procedures such as PROC GPLOT and PROC GCHART.

Starting with SAS 9.3 version of the Base product, you can also create SVG output with the SAS SG procedures such as SGPLOT and SGPANEL as well as with graphics output created with ODS Graphics. In SAS 9.4, you can also use Scalable Vector Graphics to produce animations.

Typically, when you create SVG graphics, you will want to create the output in one of these ways:

  • a standalone SVG file with a file extension of .svg
  • an HTML output file using the ODS HTML statement
  • an HTML5 output file in SAS 9.4

The output method you choose depends on your application. If you’re creating standalone SVG files, you can use that SVG file in some other document and make reference to it in another HTML page. For example, a common application for this would be creating logos in SVG that can be sized to any space. If you are using SAS 9.4, the HTML5 method is the best when creating an HTML document because the SVG can be embedded directly and there are no additional files to be moved.

In this blog post I’ll show you how to produce each one of these output types using the Base Product or SAS/GRAPH. I’ve also included a list of sample SAS/GRAPH animations that you can try.

Creating Scalable Vector Graphics with Base SAS

In SAS 9.3 and SAS 9.4, you can specify Scalable Vector Graphics output by specifying the OUTPUTFMT=SVG option on the ODS Graphics statement before the procedure step, such as:

ods graphics on / outputfmt=svg; 

The examples in this sections use the sashelp.cars data set shipped with the SAS 9.3 and SAS 9.4 Base product to produce a bubble plot.

svg_sgplot

Stand-alone SVG file. The following sample code uses PROC SGPLOT to write a standalone SVG file with the name sastest.svg to the C:\temp directory when running on the Windows operating system:

    ods _all_ close; 
    ods listing gpath='c:\temp';

    ods graphics / reset=all outputfmt=svg imagename='sastest'; 
 
    title1 'Plot of MPG City versus Horsepower';  
    proc sgplot data=sashelp.cars; 
      bubble x=horsepower y=mpg_city size=cylinders;
    run;

HTML file. This code uses the same PROC SGPLOT code to write a SVG file along with a corresponding HTML file to C:\temp when running on the Windows operating system:

    ods _all_ close; 
    ods html path='c:\temp' (url=none) file='svg.html'; 

    ods graphics / outputfmt=svg; 

    title1 'Plot of MPG City versus Horsepower';  
    proc sgplot data=sashelp.cars; 
      bubble x=horsepower y=mpg_city size=cylinders;
    run;

    ods html close; 
    ods listing; 

HTML 5 file. With SAS 9.4 only, you can use PROC SGPLOT with the ODS HTML5 statement to embed the SVG output in an HTML file. Note that with the code below, the SVG output is embedded inside the HTML output via the use of the svg_mode='inline' option on the ODS HTML5 statement.

    ods _all_ close; 
    ods html5 path='c:\temp' (url=none) file='svg.html'
                options(svg_mode='inline');

    ods graphics / outputfmt=svg; 

    title1 'Plot of MPG City versus Horsepower';  
    proc sgplot data=sashelp.cars; 
      bubble x=horsepower y=mpg_city size=cylinders;
    run;

    ods html5 close; 
    ods listing; 

Creating Scalable Vector Graphics with SAS/GRAPH

The examples in this sections use PROC GPLOT and the sashelp.class data set to produce a linear plot of weight versus height.

svg_gplot

Stand-alone SVG file. Here is sample SAS code that uses PROC GPLOT to write a standalone SVG file with the name sastest.svg to the Temp directory on your C: drive when running on the Windows operating system:

    ods _all_ close; 
    ods listing;

    filename grafout 'c:\temp\sastest.svg'; 

    goptions reset=all device=svg gsfname=grafout;  

    symbol1 i=none v=dot c=black h=1.5;
    axis1 minor=none;  
    title1 'Plot of Weight versus Height';
    proc gplot data=sashelp.class;
      plot weight*height / haxis=axis1 vaxis=axis1;
    run;
    quit;  

HTML file. Here’s how to write the same output to a SVG file along with a corresponding HTML file:

    ods _all_ close; 
    ods html path='c:\temp' (url=none) file='svg.html';  

    goptions reset=all device=svg;  

    symbol1 i=none v=dot c=black h=1.5;
    axis1 minor=none;  
    title1 'Plot of Weight versus Height';
    proc gplot data=sashelp.class;
      plot weight*height / haxis=axis1 vaxis=axis1;
    run;
    quit;  

    ods html close; 
    ods listing;

HTML 5 file. With SAS 9.4 only, the following sample code uses PROC GPLOT together with the ODS HTML5 statement to embed the SVG output in the resulting HTML file. Note that with the code below, the SVG output is embedded inside the HTML output via the use of the svg_mode='inline' option on the ODS HTML5 statement.

    ods _all_ close; 
    ods html5 path='c:\temp' (url=none) file='svg.html'
               options(svg_mode='inline');   

    goptions reset=all device=svg;  

    symbol1 i=none v=dot c=black h=1.5;
    axis1 minor=none;  
    title1 'Plot of Weight versus Height';
    proc gplot data=sashelp.class;
      plot weight*height / haxis=axis1 vaxis=axis1;
    run;
    quit;  

    ods html5 close; 
    ods listing;  

Using Scalable Vector Graphics for animation in SAS/GRAPH

Beginning with SAS 9.4, you can create animated graphs for the web using the SVG device driver together with new options available on the OPTIONS statement. Here are links to sample programs on support.sas.com that demonstrate how to create animated graphs for the web using the SAS 9.4 SVG device driver:

Post a Comment

Exporting events from SAS Environment Manager

As SAS administrators, I know you are as excited as I am by the ability of SAS Environment Manager to monitor, in detail, the performance of their SAS environments. Now, we have a robust tool to monitor, measure and report on the performance of the various SAS components. An added bonus—with each maintenance release of SAS 9.4, more features are added to SAS Environment Manager tool set.

As nice as SAS Environment Manager is, some of you may already be invested in other system monitoring tools. As a result, SAS Professional Services consultants are often asked how to integrate monitoring information from SAS Environment Manager into their existing monitoring systems, especially when it comes to notifying administrators of potential problems. Fortunately, SAS Environment Manager 2.4 now includes an event exporting service that makes it quite simple to integrate with most any third-party monitoring tool. Read More »

Post a Comment

Junior Professional Program--more reasons to apply

The application deadline for the SAS Global Forum 2015 Junior Professional Award has been extended to February 1! If you have fewer than three years’ experience using SAS in a professional setting, you’ll want to take a closer look at the requirements and apply online.

Junior Professional Program Coordinators Sally Carson and Rich La Valley recently shared survey results from SAS Global Forum 2014 award winners. Many of their comments reflect why this program is so important to recipients, to their organizations and to the SAS community.

Has the knowledge you gained at the conference helped you improve what you can do in your job?

Absolutely, the break-out sessions were directly applicable to my work and within an hour of returning to work I was putting my new knowledge to use by recoding old programs.

Yes! After attending a hands-on Enterprise Guide talk by Marje Fecht, I’ve migrated many of our projects over. My manager loves the new format since it’s so much easier to see the flows and document processes.

In particular, I learned several things about ensemble methods, as well as some of the quick functions that were discussed in Ron Cody’s presentation, which have reduced the length of code needed to write pretty substantially.

Certainly. More confident in my SAS skills, particularly after the hands-on workshops.

What part of the conference did you like best?

I really like all of the sessions on coding efficiency. They were very appropriate to my level, accessible but exposing me to new things.

I think being part of a group really helped make this experience memorable. The award itself gave our cohort a common ground to be friends and together navigate the conference for the first time.

Hands on training and introductions to SAS functionality I had not seen before.

Practical advice on how to improve my programming.

It was great to meet people with different backgrounds who use SAS. I liked bonding with the other Junior Professionals and going to the sessions that were helpful.

What was your biggest take-away from SAS Global Forum 2014?

The proceedings and materials that I brought back with me is a wealth of knowledge that will improve my SAS skills in the future.

The most striking thing I learned was how welcoming and diverse the SAS Users Community is … I haven’t had the chance to be more involved with my local SAS Users group but I am definitely more motivated now.

I learned a lot about SAS as a coding language but also about SAS as a business. I think that from a career-long perspective, the second was as valuable as the first.

Do you have comments or suggestions regarding the award package?

Volunteering was a great experience, and a great way to meet people.

This award is extremely valuable. I am sure I am not speaking only for myself when I say, without the award, I would not have been able to attend the conference.

My biggest recommendation would be promoting this to as many junior people as possible. My company’s SAS User Group sent this along but, to my knowledge, I’m the only person that even applied. I walked away from the conference having a much better understanding of how SAS operates…I left the conference feeling like SAS was a much younger, hipper company than I originally did.

If you have questions, please contact the Junior Professional Program Coordinator.

Post a Comment

SAS Visual Statistics: go from data exploration to modeling in one step

In case you haven’t read about SAS Visual Statistics, let’s start with a quick overview.

  • First, it’s an add-on to SAS Visual Analytics.
  • Second, it’s a web-based solution with an interactive, drag-and-drop interface that helps you rapidly build descriptive and predictive models.
  • Lastly, SAS Visual Analytics and SAS Visual Statistics are a powerful duo, supporting a logical flow of analysis from exploration tasks to modeling tasks.

Because of their ability to access shared data stored in SAS LASR Analytic Server, working with data in SAS Visual Analytics and SAS Visual Statistics is streamlined. To model your data in SAS Visual Statistics, it’s a recommended practice to start your analysis in SAS Visual Analytics Explorer. At first glance, this step may seem odd. But remember, in the usual course of predictive analytics, you’ll want to handle tasks such as investigating the distribution of the different variables, understanding relationships among variables or handling data manipulations before you do any actual modeling.

For one-step exploratory modeling, I find it simpler to start with the data from particular visualization types that you have already created in SAS Visual Analytics Explorer. Once you switch to a view of that data in SAS Visual Statistics, you can continue to refine the baseline model, add more variables, evaluate the model’s fitness and perform model comparisons.

Let’s look at some simple examples of how this process works using just a few visualizations that were created in SAS Visual Analytics then modeled in SAS Visual Statistics. Read More »

Post a Comment

Consolidating SAS desktop users to a central server

In trying to offer better support to SAS users, many customers’ IT departments are looking to consolidate all their SAS desktop users onto a centralized Windows, UNIX or Linux server.

This option is a very practical strategy, but implementing it satisfactorily requires a lot of assessment on how the SAS users are using SAS on their desktop--especially if you want them to be happy when they are asked to migrate to the new centralized server!  Please make sure that you add time in your project planning to do a detailed inventory and analysis of how the SAS desktop users are currently using SAS. This step is critical to ensuring there are enough computer resources on the new centralized server to assure SAS users will be productive and happy with this new infrastructure.

Determine number of cores. The most important thing that you need to do is to determine how frequently and how long it takes for each desktop user to run their SAS applications.  If each one of these users is submitting SAS jobs on their desktop that run for hours and consume at least one full core on their machine, then you will need to make sure the new centralized server can support all those individual SAS users concurrently.

If you find out that you will have more than 20 concurrent SAS sessions, each taking over an hour from start to finish, you should consider implementing a SAS Grid environment so that you can spread the SAS users over multiple instances of an operating system for optimal performance.  Please note that setting up a SAS Grid environment will add complexity to your new infrastructure as a clustered file system will be required to share data between the multiple operating system instances.

Evaluate IO throughput. In addition to making sure you have enough cores to support all the users in this new centralized environment, you need to make sure that you have enough IO throughput on the new centralized server to support the concurrent SAS sessions.  Again, understanding the IO throughput requirements of each SAS desktop user will make this task easier.  For example, you’ll want to understand whether desktop SAS users are submitting jobs that are mostly reading data sets or whether their jobs involve writing or updating large volumes of data.

SAS staff will be presenting a presentation on this topic at SAS Global Forum 2015 in Dallas, TX. For those of you who have done this consolidation in the past, please share with us your “lessons learned” so that we can incorporate it into this new SAS presentation.

As always, please let us know if you have any questions or comments on the above.

Post a Comment

Presenter Mentoring Program:  5 reasons you’ll want to enroll

Congratulations if you’re one of the over 300 presenters whose proposals for content were accepted for SAS Global Forum 2015! Now that it’s time to start preparing papers, posters and presentations, I thought this would be a good opportunity to write about the Presenter Mentoring Program, an excellent service offered to authors planning for SAS Global Forum. Read More »

Post a Comment

Goldilocks and the three cloud service models

cloud3svcsIn a recent post, I talked about the 5 essential characteristics of cloud computing. In today’s post, I will cover the three service models available in the cloud as they are defined by the National Institute of Standards and Technology, or NIST.

Like the story of Goldilocks, when it comes to choosing service models for the cloud, there is no right or wrong.  Your choice depends who you are and what you want. (Granted, that’s my own interpretation of the story).

The idea of this post is not to add more hype around cloud service models (if that’s even possible!) but to use simple examples to illustrate them. Read More »

Post a Comment

SAS Global Forum—register early, make a difference

sas_GivingTuesday_FacebookThe holiday season is a wonderful time of year – steeped in tradition, family and friends, and giving. This time of year has also created a burgeoning shopping period with decorations appearing by Labor Day!

In 2012, the 92nd Street Y in New York and the United Nations Foundation tried a new approach in an attempt to balance the consumerism of Black Friday and Cyber Monday. They designated #GivingTuesday as a day when families, businesses, communities and organizations around the world celebrate generosity and giving. They started a social media campaign that has captured the spirit of millions and inspired a new tradition of giving. Read More »

Post a Comment

Drill, baby, drill—using SAS to drill down through Google maps

No matter what your profession, political leanings or environmental philosophy, “drill, baby, drill” may be the slogan for you. In this post, I’m going to show you how to use SAS to “drill down” as it relates to the Earth’s surface or its model to be precise. We are going to drill down through Google maps. Read More »

Post a Comment

SAS Environment Manager Data Mart—the heart of the Service Management Architecture

Several new capabilities and components are available in SAS Environment Manager 2.4, the web-based administration solution for a SAS environment. For me, the most important enhancement is probably the SAS Environment Manager Service Management Architecture Framework, which provides features and functions that enable SAS Environment Manager to fit into a service-oriented architecture (SOA). The Management Architecture Framework includes:

All these components are organized around the heart of the Service Management Architecture Framework: the SAS Environment Manager Data Mart. In this post, I’d like to share more details about its setup and use. Read More »

Post a Comment