BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
sas_user_IND
Calcite | Level 5

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.

 

sas_user_IND_0-1714589756687.png

 

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.

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

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!

 

View solution in original post

3 REPLIES 3
DanH_sas
SAS Super FREQ

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.

DanH_sas
SAS Super FREQ

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!

 

Ksharp
Super User
DanH got the right idea here.
Another useful option is "clipcap ":

highlow y=obsid low=low high=high /lowcap=serif highcap=serif clipcap ;

and specify CUTOFF/MAX value in XAXIS :
xaxis display=(nolabel) values=(0 to &cutoff. by 1) offsetmin=0 offsetmax=0;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 212 views
  • 1 like
  • 3 in conversation