Data visualization with SAS programming

Graphics Template Language vs. standard proc gchart etc.

Reply
Regular Contributor
Regular Contributor
Posts: 156

Graphics Template Language vs. standard proc gchart etc.

Dear all,

to this point I used proc gchart, gplot, etc. to produce graph output with SAS. We used device=activex because the graphs look best with this device. Now we need to change to png as we need more functionality that activex doesn't support. Unfortunately I find that the png graphs produced with gchart etc. are not as good looking as the ones we had with activex. Somebody now told me that using the SAS graph template language produces nicer graphs. I have seen the output (png as well but produced with template language instead of gchart) and I must say: this is better! So I tend to do my graphs with the template language now. Before I do so I'd like to listen to other opinions because the coding is totally different to gchart and the like. Using templates with graph seems to be a completely different coding not as I thought first using proc gchart and adding a template.

So what do you think about the graph template language? Would you prefer it? Is this the direction SAS will choose for future graphs? (I don't want to invest in something that dies within the next releases.) Is it easy to learn / handle?

Best wishes

Eva

Super Contributor
Posts: 543

Re: Graphics Template Language vs. standard proc gchart etc.

Hi Eva.

I, too, used the GPLOT, GCHART, and annotate for all of our graphs, and became fairly fluent with all possible options and tricks.

When SG came along, I resisted switching over until I slowly got more familiar with some of the possible options in proc template. What I found to be the most useful tool is the ODS Graphics Designer, which is a menu driven tool that allows you to select the type of plot you want, the various options and what not, and provides the SAS code that produces the given plot. Once I have that code, I then adapt it more to what I need (increase the font, change colors...).

I don't know of SAS plans to not use SG, but I wonder I the GPLOT, GCHART procs will become unusable with future releases??

In summary,  I would invest the time to learn the new way of graphing.

Smiley Happy

Regards,

Anca.

SAS Super FREQ
Posts: 864

Re: Graphics Template Language vs. standard proc gchart etc.

SInce you are already familiar with coding graphics procedures, another alternative is for you to use the SG procedures (SGPLOT, SGPANEL, SGSCATTER). They ultimately use the GTL system to do the rendering, but they have a more concise procedure syntax to define the graph. For example, to create a bar in GCHART, you would specify something like:

proc gchart data=sashelp.class;

vbar age / sumvar=height type=mean discrete;

run;

The equivalent in SGPLOT would be:

proc sgplot data=sashelp.class;

vbar age / response=height stat=mean;

run;

However, SGPLOT can also do much more sophisticated overlaid plots and charts. SGPANEL uses a similar syntax for creating classification panels. SGSCATTER creates panels of scatter plot and scatter plot matrices. Check out the documentation for more examples.

Hope this helps!

Dan

SAS Super FREQ
Posts: 864

Re: Graphics Template Language vs. standard proc gchart etc.

One other comment: Do not be concerned about GTL going away. GTL was originally designed and developed to simplify graph creation through ODS for our procedure developers. They will continue to rely on graph templates just like they do table templates. We continue to use significant resources to enhance the system both for them and for our graphics users like you. We've build applications like the ODS Graphics Designer and the ODS Graphics Editor that completely rely on that system. It is definitely worthwhile for you to invest the time and effort to learn the system.

As for easy to learn/handle, we have three different levels of access into the system:

1. Graph Template Language (GTL) -- the most detailed, but most powerful access into the system

2. SG procedures -- procedure-style coding that should be able to handle 80% or more of your graphing needs

3. ODS Graphics Designer -- an interactive, drag-and-drop application that gives you the ability to create sophisticated graphs with not coding at all. Yet, it can generate GTL code that you can use to run graphs in batch or use as building blocks for more complex GTL graphs. This application is also a great tool for learning GTL.

Hope this helps!

Dan

Post a Question
Discussion Stats
  • 3 replies
  • 364 views
  • 6 likes
  • 3 in conversation