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

Hey there!

 

When I have a keylegend on my sgplot with several rows (down = ) and columns (across = ), the legend values get filled across each row first, and then goes down to the next.  E.g.

1  2  3  4

5  6  7

Is there an option to easily make it go down first?  I know I can make an attribute map, but I was hoping there is an easy option to toggle in the keylegend statement.

1  3  5  7

2  4  6

 

Thanks!

Michael

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

In the SG procedures, if you use the DOWN option (without ACROSS), the ORDER is internally set to COLUMNMAJOR. In your case, if you set DOWN=2, you will get the desired result.

 

Thanks!

Dan

View solution in original post

7 REPLIES 7
ballardw
Super User

You don't show the code. So I can't tell if you are specifying down= , across= or both.

Try using just the Down= option.

JeffMeyers
Barite | Level 11
Hello! If I understand correctly you want it the values to fill the columns and then rows. I don't see the option in SGPLOT, but if you convert your code to GTL the option is in the DISCRETELEGEND statement:

ORDER=ROWMAJOR | COLUMNMAJOR
specifies whether legend entries are organized into rows or into columns.
Kastchei
Pyrite | Level 9

Thanks!  I figured it was somewhere.  I think converting to GTL is more work than the data attributes map, but maybe only because I don't know how to do it! 😅

JeffMeyers
Barite | Level 11
A quick tip if you ever want to see what your SGPLOT code looks like in GTL is to use the TMPLOUT= option in the PROC SGPLOT statement. It will save a program with your current graph written in GTL.
DanH_sas
SAS Super FREQ

In the SG procedures, if you use the DOWN option (without ACROSS), the ORDER is internally set to COLUMNMAJOR. In your case, if you set DOWN=2, you will get the desired result.

 

Thanks!

Dan

JeffMeyers
Barite | Level 11
That's cool to know. Hadn't heard of that yet.
Kastchei
Pyrite | Level 9
Thanks, Dan!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 7 replies
  • 1981 views
  • 3 likes
  • 4 in conversation