Hello,
I have to create a figure equivalent to this one:
proc summary data=sashelp.cars noprint nway;
var MSRP;
class Origin DriveTrain;
output out=cars_summary lclm= uclm= mean= /autoname;
run;
data cars_for_plot;
set sashelp.cars cars_summary;
run;
proc sgpanel data=cars_for_plot;
panelby DriveTrain / layout=columnlattice noborder noheader columns=3 skipemptycells sort=ascformat;
rowaxis type=log label="MSRP";
colaxis label=" " fitpolicy=rotatealways valuesrotate=vertical discreteorder=formatted;
keylegend "ssss" / position=right noborder;
vbarparm category=Origin response=MSRP_Mean / group=DriveTrain groupdisplay=cluster grouporder=ascending baseline=10 datalabel datalabelfitpolicy=none name="ssss";
highlow x=Origin high=MSRP_UCLM low=MSRP_LCLM / group=DriveTrain highcap=serif lowcap=serif;
scatter x=Origin y=MSRP / group=DriveTrain jitter markerattrs=(symbol=circlefilled size=5) transparency=0.50 clusterwidth=0.7;
refline 1e5 / lineattrs=(pattern=shortdash) label="LLOD";
run;
I have received a request to improve two visual aspects:
Thank you for your input in advance.
proc summary data=sashelp.cars noprint nway;
var MSRP;
class Origin DriveTrain;
output out=cars_summary lclm= uclm= mean= /autoname;
run;
data cars_for_plot;
set sashelp.cars cars_summary nobs=nobs;
if _n_ =nobs-2 or _n_= nobs-1 or _n_= nobs then ref=1e5;
if _n_=nobs then label="LLOD" ;
if not missing(MSRP_Mean) then y_datalabel=MSRP_Mean+120000;
run;
proc sgpanel data=cars_for_plot;
panelby DriveTrain / layout=columnlattice noborder noheader columns=3 skipemptycells sort=ascformat;
rowaxis type=log label="MSRP";
colaxis label=" " fitpolicy=rotatealways valuesrotate=vertical discreteorder=formatted;
keylegend "ssss" / position=right noborder;
vbarparm category=Origin response=MSRP_Mean / group=DriveTrain groupdisplay=cluster grouporder=ascending baseline=10 name="ssss";
scatter x=Origin y=y_datalabel/markerchar=MSRP_Mean labelstrip;
highlow x=Origin high=MSRP_UCLM low=MSRP_LCLM / group=DriveTrain highcap=serif lowcap=serif;
scatter x=Origin y=MSRP / group=DriveTrain jitter markerattrs=(symbol=circlefilled size=5) transparency=0.50 clusterwidth=0.7;
refline ref / lineattrs=(pattern=shortdash) label=label labelpos=max ;
run;
proc summary data=sashelp.cars noprint nway;
var MSRP;
class Origin DriveTrain;
output out=cars_summary lclm= uclm= mean= /autoname;
run;
data cars_for_plot;
set sashelp.cars cars_summary nobs=nobs;
if _n_ =nobs-2 or _n_= nobs-1 or _n_= nobs then ref=1e5;
if _n_=nobs then label="LLOD" ;
if not missing(MSRP_Mean) then y_datalabel=MSRP_Mean+120000;
run;
proc sgpanel data=cars_for_plot;
panelby DriveTrain / layout=columnlattice noborder noheader columns=3 skipemptycells sort=ascformat;
rowaxis type=log label="MSRP";
colaxis label=" " fitpolicy=rotatealways valuesrotate=vertical discreteorder=formatted;
keylegend "ssss" / position=right noborder;
vbarparm category=Origin response=MSRP_Mean / group=DriveTrain groupdisplay=cluster grouporder=ascending baseline=10 name="ssss";
scatter x=Origin y=y_datalabel/markerchar=MSRP_Mean labelstrip;
highlow x=Origin high=MSRP_UCLM low=MSRP_LCLM / group=DriveTrain highcap=serif lowcap=serif;
scatter x=Origin y=MSRP / group=DriveTrain jitter markerattrs=(symbol=circlefilled size=5) transparency=0.50 clusterwidth=0.7;
refline ref / lineattrs=(pattern=shortdash) label=label labelpos=max ;
run;
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!
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.