BookmarkSubscribeRSS Feed
SASintheSouth
Calcite | Level 5

Hi, I have a bar graph that I have created and simply need to change the scaling (values) of one of the axis'.  Instead of starting at 0, I want to start at 500 and end at 700 to see a closer relationship to each value.  I've researched this and it seems there is not a way to do this in EG without coding.  I can easily populate it over to Excel and do this, but want to do it in SAS.  I know EG has limitations and am not an export on the code, even though I can do some basic procedures.  Can anyone shed any light?  It seems such an easy thing to NOT be able to do!  Smiley Happy

Thanks,

CJ in SC


2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

Depending on the procedure you used, it might be done in the ACTION statement (VBAR, for example) or it can be done with an AXIS statement. You will need to look at the code that EG generates. Usually, there is a little icon of a table with a red trackball at the bottom (inside the task) that will reveal the code. If you look at the procedure being used, you should see whether it is GPLOT or GCHART (or some other procedure).

Then look at the action statement -- either VBAR or HBAR -- you will use either RAXIS (probably) within the procedure to set values for the response axis -- either directly or linking to an AXIS statement.

The doc has some good examples. It's not hard, but there are several ways to do it changing the code. I thought that EG built an AXIS statement, but I'm not in a position to check right now. So it might be as easy as just subsituting your AXIS statement with a different value for ORDER= for the EG AXIS statement. Worst case, is you'll have to modify the code to include an AXIS statement. Anyway, I thought if you used the Bar Chart Task (instead of the Wizard), you could actually modify the AXIS statement that EG builds.

I can't run anything to test it. So this code is untested using SASHELP.SHOES, but you should be able to see with #2 or #3, if I haven't made any typos that you can start the axis at some value other than 0.

cynthia

proc gchart data=sashelp.shoes;

   where region in ('United States', 'Canada', 'Pacific');

   title1 "1) Sales for each Region starting at 0";

   vbar Region

        / sumvar=Sales

          raxis=0 to 5000000 by 500000;

run;

quit;

 

proc gchart data=sashelp.shoes;

   where region in ('United States', 'Canada', 'Pacific');

   title1 "2) Sales for each Region starting at 250,000 (RAXIS)";

   vbar Region

        / sumvar=Sales

          raxis=250000 to 7500000 by 500000;

run;

quit;

  

axis1 order=(250000 to 7500000 by 500000);

 

proc gchart data=sashelp.shoes;

   where region in ('United States', 'Canada', 'Pacific');

   title1 "3) Sales for each Region starting at 250,000 (AXIS stmt)";

   vbar Region

        / sumvar=Sales

          raxis=axis1;

run;

quit;

goptions reset=all;

SASintheSouth
Calcite | Level 5

Thank you Cynthia, it was the

axis1

order=(250000 to 7500000 by 500000);

statement.

I am such a newbie I was using the Wizard and no the other way.  If I had used that way the first time I wouldn't have had that problem.

Thanks again for your help!

CJ

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
  • 2 replies
  • 2042 views
  • 1 like
  • 2 in conversation