Hi everyone,
Is there any way to reduce the the width of line or size of axis here ?
I have used below steps and the output looks like this.
proc sgplot data=all_2 nowall noborder nocycleattrs noautolegend dattrmap=attrmap sganno=anno;
refline ref / lineattrs=(thickness=13 color=cxf0f0f7);
highlow y=obsid low=lowercl high=uppercl/type=line barwidth=1 LINEATTRS=(thickness=2);
scatter y=obsid x=value / markerattrs=(symbol=squarefilled) ;
scatter y=obsid x=value / markerattrs=(size=0) x2axis;
refline 1 / axis=x;
text x=xl y=obsid text=text / position=bottom contributeoffsets=none strip ;
yaxistable char / location=inside position=left textgroup=id NOLABEL
textgroupid=text indentweight=indentWt;
yaxistable per1 per2 / location=inside position=left labelattrs=(size=7) valueattrs=(size=4);
yaxistable col0002 / location=inside position=right pad=(right=15px)
labelattrs=(size=7) valueattrs=(size=4);
yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.0 ;
xaxis display=(nolabel) values=(0.0 0.5 1.0 1.5 2.0 2.5);
x2axis label='Hazard Ratio' display=(noline noticks novalues) labelattrs=(size=8);
run;
Some points to be assumed here :
(1) Left side data is dummy the text in 1st column are bit long so I have already used the space at its best.
(2) I cannot keep the values outside the graph it has to be on left and right side.
Please suggest how could I reduce th size of the axis or the "lines" in highlow statement so that it will not overwrite the values around it.
Thank you in advance.
I have another recommendation that should keep the HIGHLOW from running into your AXISTABLE and still convey to the viewer that the data goes beyond 2.5. Create a temporary dataset that clamps the highly upper value to 2.5 and puts an arrow to indicate that the highly would continue beyond 2.5. The data step would looks something like the following:
data temp_all_2;
set all_2;
length cont $ 11;
if upperci > 2.5 then do;
upperci=2.5;
cont="BARBEDARROW";
end;
else
cont="NONE";
run;
Then, use this dataset on the proc and set HIGHCAP=cont on the HIGHLOW. There are also other arrow types from which to choose.
hope this helps!
In the LINEATTRS of the HIGHLOW, you have the thickness set to 2. You can just remove the LINEATTRS, and the default should be 1.
I have another recommendation that should keep the HIGHLOW from running into your AXISTABLE and still convey to the viewer that the data goes beyond 2.5. Create a temporary dataset that clamps the highly upper value to 2.5 and puts an arrow to indicate that the highly would continue beyond 2.5. The data step would looks something like the following:
data temp_all_2;
set all_2;
length cont $ 11;
if upperci > 2.5 then do;
upperci=2.5;
cont="BARBEDARROW";
end;
else
cont="NONE";
run;
Then, use this dataset on the proc and set HIGHCAP=cont on the HIGHLOW. There are also other arrow types from which to choose.
hope this helps!
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: