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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

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.

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
  • 7 replies
  • 1759 views
  • 3 likes
  • 4 in conversation