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
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:
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;
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.;
Here's how to get started with a few lines in PROC SGPLOT:
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.
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.