Data visualization with SAS programming

What graph do I need?

Reply
Regular Contributor
Posts: 235

What graph do I need?

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

Contributor
Posts: 42

What graph do I need?

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

Regular Contributor
Posts: 235

What graph do I need?

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;

Super User
Posts: 11,123

Re: What graph do I need?

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.;

SAS Super FREQ
Posts: 3,626

Re: What graph do I need?

Ask a Question
Discussion stats
  • 4 replies
  • 213 views
  • 0 likes
  • 4 in conversation