BookmarkSubscribeRSS Feed
michelconn
Quartz | Level 8

I want to add a full border around the the graph I'm making in sgplot. I have a line for the X and Y graph but can't find a any solution to add a line for the top and right side the like the example below that has a full box around the graph. The code below is what I'm using to create the graphs. Thanks! 

ch2f1.gif

%macro kapsur(title,group,trantype,whereStatement);
title "&Title";
%ProvideSurvivalMacros;
%let TitleText0 = "&title";
%let TitleText1 = &titletext0 " for " STRATUMID;
%let TitleText2 = &titletext0;
%let InsetOpts = autoalign=(BottomRight) border=true BackgroundColor=GraphWalls:Color Opaque=true;
%let LegendOpts = title=GROUPNAME location=inside across=1 autoalign=(BottomLeft);
%let StepOpts = lineattrs=(thickness=2.5);
%CompileSurvivalTemplates;
ods output Survivalplot=SurvivalPlotData;
%if %isBlank(&whereStatement) and &group = AlloType %then %do;
proc lifetest data=bmt2 (where=(TransplantDate >= '01Jan2020'd and TransplantDate <= '31Dec2023'd and AllTransplantTypes = "&trantype"))
plots=survival(strata=panel) notable;
time SurvivalTime * nonsurvival(0);
strata &group;
&whereStatement;
run;
%end;
proc lifetest data=bmt2 (where=(TransplantDate >= '01Jan2020'd and TransplantDate <= '31Dec2023'd and AllTransplantTypes = "&trantype"))
plots=survival notable;
time SurvivalTime * nonsurvival(0);
strata &group;
&whereStatement;
run;
ods output close;
proc sort data=Survivalplotdata; by Stratum time; run;
data Survivalplotdata; set Survivalplotdata;; by stratum time notsorted; if last.stratum and last.time then label=stratum; run;
title "&Title";
%if %isBlank(&whereStatement) %then %do;
proc sgplot data=SurvivalPlotData noborder;
styleattrs axisextent=data;
/* dropline x=0 y=0.2 / dropto=y;*/
/* dropline x=0 y=0.4 / dropto=y;*/
/* dropline x=0 y=0.6 / dropto=y;*/
/* dropline x=0 y=0.8 / dropto=y;*/
/* dropline x=0 y=1.0 / dropto=y;*/
/* step x=time y=survival / group=stratum name='s' curvelabel curvelabelpos=auto curvelabelloc=inside; *Line Graph;*/
step x=time y=survival / group=stratum name='s' datalabel=label lineattrs=(thickness=2.5px); *Line Graph;
scatter x=time y=censored / markerattrs=(symbol=plus) name='c'; *Censored Label;
scatter x=time y=censored / markerattrs=(symbol=plus) GROUP=stratum; *HashMarks;
/* xaxistable atrisk / x=atrisk class=stratum colorgroup=stratum valueattrs=(weight=bold); *At risk Table;*/
keylegend 'c' / location=inside position=bottomright;
keylegend 's' / location=inside position=bottomleft across=1;
yaxis TICKSTYLE=OUTSIDE min=0 max=1;
run;
%end;
%else %do;
proc sgplot data=SurvivalPlotData noborder;
styleattrs axisextent=data;
/* dropline x=0 y=0.2 / dropto=y;*/
/* dropline x=0 y=0.4 / dropto=y;*/
/* dropline x=0 y=0.6 / dropto=y;*/
/* dropline x=0 y=0.8 / dropto=y;*/
/* dropline x=0 y=1.0 / dropto=y;*/
step x=time y=survival / group=stratum name='s' lineattrs=(thickness=2.5px); *Line Graph;
scatter x=time y=censored / markerattrs=(symbol=plus) name='c'; *Censored Label;
scatter x=time y=censored / markerattrs=(symbol=plus) GROUP=stratum; *HashMarks;
/* xaxistable atrisk / x=atrisk class=stratum colorgroup=stratum valueattrs=(weight=bold); *At risk Table;*/
keylegend 'c' / location=inside position=bottomright;
/* keylegend 's' / location=inside position=bottomleft across=1;*/
yaxis TICKSTYLE=OUTSIDE min=0 max=1;
run;
%end;
%mend;

 

 

1 REPLY 1
Ksharp
Super User

All you need to do is just changing the STYLE attached with your ods destination. For example, here my ods destination is HTML .

ods html style=sasweb;
proc sgplot data=sashelp.class;
scatter x=weight y=height/group=sex datalabel=name;
run;

 

Ksharp_0-1741417803633.png

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1 reply
  • 681 views
  • 0 likes
  • 2 in conversation