BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mbunse
Obsidian | Level 7

On our SAS system GCHART seems to cast floating values in in a bar chart to integer values.

 

The following code reproduces my problem:

data test;
do Bin=0 to 1000 by 10;
	value=ranuni(1);
	output;
end;
run;

proc gchart data=test;
vbar Bin / discrete sumvar=value OUTSIDE=SUM;
run;

The resulting plot is empty and looks like this:

SAS GCHART Problem.jpg

 

The same code, but with

goptions reset=all;

inserted before the PROC GCHART statement gives the expected behaviour but in an ugly style:

SAS GCHART Problem 2.jpg

What is wrong with our setup? Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
mbunse
Obsidian | Level 7

I contacted SAS support and just received the answer that they were able to reproduce my problem if only SAS Report is selected as output format. The problem also occures in SAS Enterprise Guide 7.1. Developers are working on a fix.

View solution in original post

12 REPLIES 12
ballardw
Super User

Without knowing what you are attempting to accomplish it is hard to say "what is wrong". There is likely nothing at all wrong with your set up jsut a likely misunderstanding of how the procedures and options interact.

 

Many graphic options have some persistence. So the Goptions reset returns everything to SAS defaults from what may have been set previously.

 

If you want to control the appearance of the axis then you need to provide AXIS statements  and instructions in the procedure for what role (response variable, grouping variable, actual ticks) each of those axis statements will play.

 

I would suggest changing to the statistical graphic procedures such as SGPLOT as that is where the development is currently being done in SAS graphics displays. You would likely still need to specify xaxis and yaxis to control some features.

Note the the active ODS style has significant impact on appearance as do formats assigned to varaibles. And almost anything that attempts to generate 100 text labels on an axis is going to be ugly.

mbunse
Obsidian | Level 7
Hi ballardwd,

thanks for your quick response!

I am using PROC GCHART since this is also used when creating the bar chart with the SAS EG GUI. (I'm currently stuck to EG version 5.1 an SAS 9.2 in my organization.) The GUI sets parameters for the axes but this does not cure the behavior, that the bar height is cast to an integer value.

I also played around with formats with no results, except that the heights casted to integers are shown with more decimal places.
ballardw
Super User

I can't help with EG as I do not have 5.1 available and do not use it. You will need to look through the option menus to find axis controls and I'm not at all familiar with where they are.

 

I do not believe that anything is getting "cast as integer" but something in the default for the task, perhaps count is involved.

 

Note that you likely have a not in the log for the "ugly" chart that the widths of the lables are two wide for the space available. AXIS statements allow such things as controlling the text angle and charater rotation ot get a slighlty mor legibil axis label, but 100 labels displayed in a few inches are going to be crowed regardless.

 

TomKari
Onyx | Level 15

It looks to me like the difference you want is to have the horizontal axis labelled in multiples of 50.

 

Do you want your values of "value" summarized, i.e. only one bar for each five values, or do you want each of your values of "value" displayed, but only labels on the horizontal axis for every five bars?

 

When I run your code in my EG environment, I get exactly your ugly, but functional, output.

 

Tom

mbunse
Obsidian | Level 7

I want to display all bins with their respective value. For me, it still seems that a specific goption is set, which results in the values to be cast to integer, but I was not able to find an according option in the documentation.

TomKari
Onyx | Level 15

I'm far from an expert on SAS/Graph, but I've been digging a bit and here are some suggestions:

 

I suspect that somewhere in your software stack, you're both running an AXIS statement that's giving you the horizontal axis you want, and another graph option that's screwing up the vertical axis.

 

Try running this in a code window where you're getting the empty graph, witout resetting the goptions. It may give you some insight:

 

proc goptions axis nolist; run;

 

Tom

mbunse
Obsidian | Level 7

Hi Tom,

 

thanks for your help. This is the complete log for the command you gave me:

1                                                          The SAS System                               11:46 Tuesday, July 18, 2017

1          ;*';*";*/;quit;run;
2          OPTIONS PAGENO=MIN;
3          %LET _CLIENTTASKLABEL='Programm1';
4          %LET _CLIENTPROJECTPATH='V:\...';
5          %LET _CLIENTPROJECTNAME='Projekt.egp';
6          %LET _SASPROGRAMFILE=;
7          
8          ODS _ALL_ CLOSE;
9          OPTIONS DEV=ACTIVEX;
NOTE: Procedures may not support all options or statements for all devices. For details, see the documentation for each procedure.
10         GOPTIONS XPIXELS=0 YPIXELS=0;
11         FILENAME EGSR TEMP;
12         ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR STYLE=HtmlBlue
12       ! STYLESHEET=(URL="file:///C:/...") NOGTITLE NOGFOOTNOTE
12       ! GPATH=&sasworklocation ENCODING=UTF8 options(rolap="on");
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
13         
14         GOPTIONS ACCESSIBLE;
15         proc goptions axis nolist; run;

AXIS1 WIDTH=1 STYLE=1 MINOR=NONE ;

AXIS2 WIDTH=1 STYLE=1 MINOR=NONE ;

NOTE: PROCEDURE GOPTIONS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

16         
17         GOPTIONS NOACCESSIBLE;
18         %LET _CLIENTTASKLABEL=;
19         %LET _CLIENTPROJECTPATH=;
20         %LET _CLIENTPROJECTNAME=;
21         %LET _SASPROGRAMFILE=;
22         
23         ;*';*";*/;quit;run;
24         ODS _ALL_ CLOSE;
25         
26         
27         QUIT; RUN;
28         

Not sure how this can help, though.

 

Cheers,

 

Moritz

TomKari
Onyx | Level 15

Well, negative help I guess, I think the axis statements are elminated.

 

How about another experiment. Start up a brand new session of EG, and immediately run the code you use in your example:

 

data test;
do Bin=0 to 1000 by 10;
 value=ranuni(1);
 output;
end;
run;

proc gchart data=test;
vbar Bin / discrete sumvar=value OUTSIDE=SUM;
run;

 

Do you see the empty chart with 0 on the left, or the busy chart with too many numbers on the bottom? I'm trying to figure out what in your environment accounts for the change.

 

Tom

 

mbunse
Obsidian | Level 7

Wow! It's even more strange than I expected:

 

In a clean EG session, the resulting plot looks like I would expect it to look like:

SAS GCHART Problem 3.jpg

 

But when I run the code again, the same code produces the empty plot!?!?

TomKari
Onyx | Level 15

Okay, something odd is happening in your environment. If you were just running the snippet of code that I included, first, you shouldn't be getting the horizontal axis only every 50. Second, your bars shouldn't be labelled with the values.

 

Somehow, something is getting pre-executed in your environment, and there's no way for anyone on this community to be able to diagnose that. I'm afraid you'll have to dig, with the SAS experts at your organization.

 

Good luck, let us know what turns up!

   Tom

mbunse
Obsidian | Level 7

I contacted SAS support and just received the answer that they were able to reproduce my problem if only SAS Report is selected as output format. The problem also occures in SAS Enterprise Guide 7.1. Developers are working on a fix.

TomKari
Onyx | Level 15

Thanks for the update!

 

Tom

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

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.

Discussion stats
  • 12 replies
  • 1815 views
  • 0 likes
  • 3 in conversation