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:
The same code, but with
goptions reset=all;
inserted before the PROC GCHART statement gives the expected behaviour but in an ugly style:
What is wrong with our setup? Any help would be appreciated.
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.
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.
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.
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
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.
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
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
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
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:
But when I run the code again, the same code produces the empty plot!?!?
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
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.
Thanks for the update!
Tom
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.