Since the colors you are using represent the same thing, gender, I would be tempted to only display one of the legends in the KEYLEGEND statement and add a title to keylegend that would indicate look at scale A for bar and scale B for line values.
Another possibility would be to put the bar chart and line chart content in separate legends. Position the bar chart legend at the outside/bottom-left and the line chart legend at the outside/bottom-right. Title each legend "Scale A" and "Scale B" appropriately. The legend proximity to the correct axis and the legend title should help create the correct association.
Registration is open! SAS is returning 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. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.