BookmarkSubscribeRSS Feed
Relax
Fluorite | Level 6
proc sql;
create table CARS as
select * 
from sashelp.cars
where Type = "SUV" or Type = "Sedan";
quit;

proc template;
define statgraph scatter;
begingraph / backgroundcolor=CXD1D0CE border=true borderattrs=(color=CXEDDA74 thickness=5);
entrytitle halign=left textattrs=(size=15pt) "Plot";
entrytitle halign=left textattrs=(size=12pt weight=normal) "Scatter Plot" / opaque=true backgroundcolor=CXFFFFFF;
layout datalattice rowvar=Type / 
				   headerlabeldisplay=value rowheaders=left
                   rowaxisopts=(griddisplay=on gridattrs=(pattern=dash) display=(ticks tickvalues))
				   columnaxisopts=(griddisplay=on gridattrs=(pattern=dash) labelattrs=(size=12pt weight=normal))
				   headerbackgroundcolor=CXFFFFFF headerlabelattrs=(size=10pt weight=normal);
layout prototype;
scatterplot x=MPG_City y=Cylinders / markerattrs=(color=CXC11B17 symbol=circlefilled) name='a';
scatterplot x=MPG_City y=EngineSize / markerattrs=(color=CX57E964 symbol=circlefilled)  name='b';
scatterplot x=MPG_City y=Horsepower / yaxis=y2 markerattrs=(color=CX2B65EC symbol=circlefilled)  name='c';
endlayout;
sidebar / align=bottom;
	discretelegend "a" "b" "c"/ border=false valueattrs=(size=11pt);
endsidebar;
endlayout;
endgraph;
end;
run;

proc sgrender data=CARS template=scatter;
run;

Capture_Car.PNG

 

Hi All,

 

Here attached are my code and plot and I want to switch the order of panels, like "SUV" at the bottom and "Sedan" at the top.  How to solve this issue?

 

Thanks!

2 REPLIES 2
DanH_sas
SAS Super FREQ

On the LAYOUT DATALATTICE statement, say:

 

SORTORDER=(ROWVAR=DESCENDINGFORMATTED)

 

Hope this helps!

Dan

Relax
Fluorite | Level 6

Thanks, Dan!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 1207 views
  • 2 likes
  • 2 in conversation