BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9

Hi, i'm new to creating graphs in SAS.

I have to create a graph which looks like this:

On x-ax: months

I need two Y-axes: on the left measure A, on the right measure B.

I need bars for measure A, a line with at each month a square for Measure B.

I need a dotted line for the median of measure B.

At last i need an average of measure A for the last year which is also represented as a bar in the graph. Is this possible in the graph or better to calculate up front?

So my main question is: what kind of graph do I have to start with? An example would be nice.

Thanks

Filip

4 REPLIES 4
jcbell
Obsidian | Level 7

Filip,

I would probably start with a bar-line graph.  You can either add additional plots or annotate the chart to create the look you want.

See this example:

http://robslink.com/SAS/democd45/gblstock_info.htm

Filipvdr
Pyrite | Level 9

Thanks, this comes quite near of what i have to use... Can you tell me how I can sort on date?

axis1 label=('Volume (%)') order=(0 to 200 by 50) minor=none;
axis2 label=('Tat (DAYS)') order=(0 to 7 by 1) minor=none;
axis3 label=('Month');
axis3 order=("01JAN2010"d to "01MAR2011"d by month);

proc gbarline data=graph;
   bar month / discrete
      sumvar=RQPV raxis=axis1 maxis=axis3
      width=15 des='' name="Test" ;
   plot /
      sumvar=TAT raxis=axis2;
run;

ballardw
Super User

Filipvdr wrote:

Thanks, this comes quite near of what i have to use... Can you tell me how I can sort on date?


if you have a date variable the use Proc sort data=graph; by <date variable>;run; If you want different bars for Jan 2010, Jan 2011, Feb 2010 and Feb 2011 your variable MONTH is likely not to quite get you there unless MONTH includes a year component. A SAS date variable using a format of MONYY. or MMYY. might work better.

Your code would need changes of :

    bar <datevariable> /   ;

    format <datevariable> MONYY.;

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1674 views
  • 0 likes
  • 4 in conversation