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 2024

innovate-wordmarks-white-horiz.png

SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

Submit your idea!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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