2

I have a proc GHART where horizontal axis is midpoint axis and as it is automatically calculating midpoints all the values appears on horizontal axis as the tick marks.

In proc GPLOT and other procedures we can suppress the values/labels displayed on axis using MAJOR and MINOR options of the axis but those are not useful. Even assigining blank value for desired ticks using

axis option value=(T=n '')

is cumbersome. Here we have midpoints for every 5 minutes interval so I want to display only hour values on axis and rest of them should be displayed as minor ticks. Does anyone here suppressed values appearing on MAXIS earlier?

flag

1 Answer

2

Here is a way to get the axis you describe with using both GPLOT and GCHART, and then combining the two using GREPLAY.

data test;
format date mmddyys.;
do date= '01JAN09'd to '01JAN10'd;
    revenue =  floor(500 * uniform(0));
    output;
end;
run;

/** delete any images in work catalog **/

proc datasets lib=work MEMTYPE=CATALOG;
delete  gseg;
run;

/** bar chart with no axes **/

axis1 value=none label=none  origin=(12 pct, 12 pct) LENGTH=80 pct;
axis2 LENGTH=80 pct value=none label=none  offset=(0,0);
proc gchart data=test;
   hbar date /  sumvar=revenue levels=366 discrete nostat MAXIS=axis1 RAXIS=axis2;
run;
quit;

/** plot with only axes **/

axis3 order=('01JAN09'd to '01JAN10'd by month) origin=(12 pct, 12 pct)  offset=(1 pt,1 pt) LENGTH=80 pct;
axis4 LENGTH=80 pct offset=(0,0);
symbol interpol=none value=none;
proc gplot;
plot date * revenue / vAxis=axis3 hAxis=axis4;
run;
quit;

/** combine both plots **/

  proc greplay tc=work.tempcat nofs;
  tdef overlay des='One panel template'
     1/llx=0   lly=0
        ulx=0   uly=100
        urx=100 ury=100
        lrx=100 lry=0
        color=lipk;
     template overlay;
     list template;
quit;

proc greplay igout=gseg gout=gseg
             tc=tempcat nofs;
             template=overlay;

  list template;

     treplay
           1:gchart
           1:gplot;
quit;
link|flag
Nice solution Steve. – Moderator Oct 28 at 13:51

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.