Data visualization with SAS programming

gchart using a stored process - formatting

Reply
N/A
Posts: 0

gchart using a stored process - formatting

Hi

we want to create a bar-chart using proc gchart to display it via a stored process in SAS Portal. Therefore we got some formatting problems:

1. we used ouside=sum to display the sum of the bar values. using SAS Enterprise Guide it looks well, but using the some code in a stored process and displaying the output on SAS Portal the sum is written extremly small. Is there any way to change the fontsize? we were able to change the fontsize for the axis, but not directly in the graph. Does anyone know how we can do that?

2. we also use the option subgroup. If there is any negative value in one bar, the sum is written under the bar, if there are only positive values it is written above. Is there any way to write it always above the bars?

3. also in proc gchart we want to use a special date format to write the monthname in German. This format works perfect on a data step but when using it in a proc gchart it only writes %B instead of the monthname. How can we use the format?

I hope, anyone can help me. Thanks.

Sandra
SAS Employee
Posts: 963

Re: gchart using a stored process - formatting

With traditional (such as dev=gif or dev=png) SAS/Graph, you should be able to set a "locale" and use the 'nl' formats, such as ...

options locale=german_germany;
data foo;
format date nldatemn.;
date='01jan2010'd; value=8.3; output;
date='01feb2010'd; value=5.2; output;
run;

proc gchart data=foo;
hbar date / discrete type=sum sumvar=value;
run;

-----

If this technique is working for you in EG but not in Stored Process, is it possible that your Stored Process is using a different device than your EG job? For example, maybe EG is using device=gif or device=png (in which *all* the SAS/Graph options, formats, etc work), and perhaps the Stored Process is defaulting to device= activex/actximg or device= java/javaimg (in which many options/formats are not supported, or are only partially supported)?

I would suggest setting up EG to use device=png, and also hard-coding your Stored Processes to use device=png. I'm copy-n-pasting below a note I wrote to myself about how I convert my SAS jobs to Stored Processes (it's not real obvious how to do it, otherwise) - hopefully it will be helpful to you also ...

=====

Modify My SAS Sample
--------------------

First, copy the sas job (ie, my sample) to the directory where you're
going to keep your stored processes - in my case that was ...

C:\MySASData\StoredProcesses\esdmap_stp.sas

My sas samples are hard-coded to run standalone, and use ods html
to write out the gif (or png) and html file to the current directory -
you'll need to remove that hard-coding, and add a few lines with the
magic-incantations to let it run as a stored process...

First, I deleted the following line at the top of my sas job...

filename odsout '.';

Then I deleted/replaced the following ods lines...

ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" (title="Some text") style=minimal;

With the following stored-process-specific lines. These special macro
variables are *very* important, and they tell stpbegin to run the job
using dev=gif (or png) and to keep the titles inside the graph (otherwise
the stored process will default to device=activex, and the titles will
be outside the graph - this has confused many people, because
stpbegin ignores your normal device=gif (or png) and "ods gtitles" statements).
So, just take my word for it -- this is *very* necessary! Smiley Happy

(Note - as of v9.2, it's probably preferable to use dev=png than gif
because png supports 16-million colors, and gif only supports 256.
And also, if you're using a style other than 'minimal', specify that
style here - I use style=minimal a lot, but you might prefer
something different)

%let _GOPT_DEVICE=png;
%let _ODSOPTIONS=gtitle gfootnote style=minimal;
%stpbegin;



And at the end of the sas job I deleted/replace the following ods lines ...

ods html close ;
ods listing ;

With the following line...

%stpend;
=====
SAS Super FREQ
Posts: 8,646

Re: gchart using a stored process - formatting

Hi:
Just an addenda. If you ARE going to override the STYLE to something other than minimal, you can change it as Robert showed:
[pre]
%let _GOPT_DEVICE=png;
%let _ODSOPTIONS=gtitle gfootnote style=sasweb;
%stpbegin;
[/pre]


And, there's an alternate method to change it like this (using explicit reserved macro variables for the STYLE= value and the STYLESHEET= value):
[pre]
%let _GOPT_DEVICE=png;
%let _ODSSTYLE=sasweb;
%let _ODSSTYLESHEET=;
%let _ODSOPTIONS=gtitle gfootnote;
%stpbegin;
[/pre]


As explained in this paper on ODS Options and SAS Stored Processes:
http://www2.sas.com/proceedings/forum2007/021-2007.pdf

If there is any automatic CSS file (or style sheet) value for _ODSSTYLESHEET in place, you want to set it to a NULL value (why there's nothing after the = sign in the %LET statement). Sometimes, depending on the client application, the style sheet can be used instead of the SAS template style. You may not need it in your case for Portal execution, but in other client apps, the stylesheet might come into play unless you explicitly set it before the %STPBEGIN invocation statement.

cynthia
N/A
Posts: 0

Re: gchart using a stored process - formatting

Thanks. The Option DEVISE= works perfect and solves all problems.
Post a Question
Discussion Stats
  • 3 replies
  • 215 views
  • 0 likes
  • 3 in conversation