BookmarkSubscribeRSS Feed
kds
Calcite | Level 5 kds
Calcite | Level 5

Hi ,

when using gbarline , the legend of bar and the legend of plot are getting displayed one above the other below the X-axis.. How do I display them horizontally in the same line just below the X-axis?

they are getting displayed like:

Legend_bar

Legend_line

And i wanted to get them displayed as:

Legend_bar     Legend_line

Thanks


5 REPLIES 5
ballardw
Super User

The Bar and Plot statements allow use of separate LEGEND references. In the LEGEND definition there are options for location.

You may be looking at:

legend1 position=(bottom left outside);

legend2 position=(bottom right outside);

and add

legend=legend1 to the options for BAR

legend=legend2 to the options for the first plot statement.

kds
Calcite | Level 5 kds
Calcite | Level 5

I tried ur suggestion with the code which is below:

---------- -------------------------

data gbarline_ex;
input x1 $5. y1 y2;
cards;
rang1 1000 1
rang2 2000 2
rang3 3000 3
rang4 4000 4
rang5 5000 5
rang6 6000 6
;
run;

symbol1 v=dot i=join c=red h=0.5 l=1;
legend1 label=none position=(bottom left outside);
legend2 label=none position=(bottom right outside);
axis1 label=none;
axis2 label=none;
proc gbarline data=gbarline_ex;
bar x1 / discrete sumvar=y1 raxis=axis1 legend=legend1;
plot /sumvar=y2 axis=axis2 legend=legend2;
run;

----------------------------------- ---------------

but the legends are going extreme left and extreme right....and not getting displayed below the X-axis.

here is the output :

Also any idea why the blue legend is showing label as X1 , it should be Y1 ...right?

Please suggest...

barline1.jpeg


ballardw
Super User

Remove the OUTSIDE part of the position then.

The Legend is associated with the BAR or PLOT variable. X1 is your BAR variable and the position for legend1 says to position on the left side of the chart. If you want the Y2 on the left then switch the RIGHT and LEFT in the legend positions.

kds
Calcite | Level 5 kds
Calcite | Level 5


I removed "outside"  still getting both the legends on the extreme end.  Also tried switching RIGHT and LEFT as suggested ..but   no success.

ghbg
Fluorite | Level 6

Hello

I am also having this problem. I found your post in the discussion forum, although I can see it was from a long time ago.

Did you manage to find a solution?

George

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 5 replies
  • 747 views
  • 0 likes
  • 3 in conversation