BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
need_some_help
Calcite | Level 5

Hi!

In my Vbar chart I have a legend with a lot of entries, the most appropriate place for it is under the chart (with the same width as chart - fit page). So it is shown there but there is a little problem - values are listed first from left to right and then from top to bottom ('rows-filling') and I need them to go first from top to bottom and then from left to right ('columns-filling'). I've tried to use Accross= and Down= options but it didn't help. I've also got known about rowmajor | colmajor - but I don't know how to use them correctly (there are no examples at all....). Does anyone have any ideas?

P.S.

To avoid misunderstanding:

               HAVE                                                      NEED

name1     name2     name3                        name1     name3     name5

name4     name5     name6                        name2     name4     name6

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

Hi:

  ROWMAJOR or COLMAJOR will do what you want. They are single word options that go in your LEGEND statement. For example:

legend1 frame shape=symbol(14pt,12pt)

        label=(f="Albany AMT/bold" height=12pt 'COLMAJOR: ')

        colmajor  /* ~~ or change this line to ROWMAJOR */

        down=2

        position=(bottom center outside);

  Then, you will need to link the LEGEND statement of your choice with the LEGEND= option in your PLOT or VBAR action statement.

proc gchart data=testgrp;

  title 'VBAR with COLMAJOR';

  vbar var1/ sumvar=var2 type=mean

       subgroup=var3

       legend=legend1;

run;

quit;

  You may need to edit the code created by Enterprise Guide in order to specify ROWMAJOR or COLMAJOR -- I don't have a good memory of the task or wizard selections to tell you whether it's there or not.

cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
Diamond | Level 26

Hi:

  ROWMAJOR or COLMAJOR will do what you want. They are single word options that go in your LEGEND statement. For example:

legend1 frame shape=symbol(14pt,12pt)

        label=(f="Albany AMT/bold" height=12pt 'COLMAJOR: ')

        colmajor  /* ~~ or change this line to ROWMAJOR */

        down=2

        position=(bottom center outside);

  Then, you will need to link the LEGEND statement of your choice with the LEGEND= option in your PLOT or VBAR action statement.

proc gchart data=testgrp;

  title 'VBAR with COLMAJOR';

  vbar var1/ sumvar=var2 type=mean

       subgroup=var3

       legend=legend1;

run;

quit;

  You may need to edit the code created by Enterprise Guide in order to specify ROWMAJOR or COLMAJOR -- I don't have a good memory of the task or wizard selections to tell you whether it's there or not.

cynthia

need_some_help
Calcite | Level 5

Cynthia, many thaks! I didn't expected that is so simple. And with value option I can specify the order I need. So I can change my legend in any way! Thanks!!!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 1760 views
  • 1 like
  • 2 in conversation