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

Ho do i get rid of white space within each cell that results from altering the variable used as datalabel (see attached pdf image).

 

E.g. in cell "-Overall-" I want to show the discrepancy in timeliness of first antibiotics administrations and subsequent administrations. The green line presents first administration and the dark green line subsequent administrations. The vertical bar chart is the distribtion for the first administration. 

 

When I use labels that only contain "60.0%" and "44.1%", I don't have a problem with white space. But I want to help the reader and added " | 1st admin." and " |nth admin." using:

 

sum30cL=strip(strip(sum30c)!!" | 1st admin.");
sum30cOverallL=strip(strip(sum30cOverall)!!" | nth admin.");

 

sum30cL and sum30cOverallL have normal length, format and informat.

 

Anyone knows the reason of the sudden white space on the right side within each cell?

 

 

Code for plot:


ods listing;
ods graphics /
reset=index
imagename='Figure overall colour'
imagefmt=jpg
width=40cm
height=30cm
noborder;
ods listing gpath="&bron " image_dpi=400;
proc sgpanel data=fig1tot noautolegend;
panelby ABclass /
columns=2
rows=5
spacing=5
novarname
noborder
noheaderborder
skipemptycells
headerbackcolor="#2c7fb8"
headerattrs=(color=white size=8 weight=bold family=calibri)
sort=ascformat;
vline diffvstoedcat /response=sum30 lineattrs=(color="#b3de69" pattern=solid thickness=2)
datalabel=sum30cL datalabelpos=right datalabelattrs=(size=8 color=darkgrey family=calibri weight=bold);
vline diffvstoedcat /response=sum30Overall lineattrs=(color="darkgreen" pattern=solid thickness=2)
datalabel=sum30cOverallL datalabelpos=right datalabelattrs=(size=8 color=darkgrey family=calibri weight=bold);
vbar diffvstoedcat / response=_PERC_
baselineattrs=(thickness=0)
nozerobars
colorresponse=diffvstoedcat2 colormodel=("#b3de69" "#fb8072" "black")
nooutline fill
datalabel=_PERC_2 datalabelattrs=(size=6 color=darkgrey family=calibri) datalabelfitpolicy=rotate;
dropline x=0 y=30/ lineattrs=(pattern=36 thickness=1 color="#377eb8") dropto=x;
rowaxis display=(noline noticks) label="Percentage"
valueattrs=
(family=calibri
color=black
size=8
style=normal)
values=(0,10,20,30,40,50,60,70,75)
valuesdisplay=("0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "")
labelattrs=
(family=calibri
color=black
size=8
style=normal
weight=bold);
colaxis display=(noticks) label="Minutes deviation from prescribed"
valueattrs=
(family=calibri
color=black
size=8
style=normal)
values=(-13 to 14 by 1)
valuesdisplay=(">-120min" "-110min to -119min" "-100min to -109min" "-90min to -99min" "-80min to -89min"
"-70min to -79min" "-60min to -69min" "-50min to -59min" "-40min to -49min" "-30 to -39min" "-20min to -29min"
"-10min to -19min" "0min to -9min" "0" "0min to 9min" "10min to 19min"
"20min to 29min" "30min to 39min" "40min to 49min"
"50min to 59min" "60min to 69min" "70min to 79min"
"80min to 89min" "90min to 99min" "100min to 109min"
"110min to 119min" ">120min" "Not administered")
labelattrs=
(family=calibri
color=black
size=8
style=normal
weight=bold);
colaxistable _FREQ_/
label
position=bottom
droponmissing
valueattrs= (family=calibri
size=5
style=normal)
labelattrs=
(family=calibri
color=black
size=8
style=normal);
label _FREQ_="n=";
run;
ods graphics off;
ods listing close;

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

The space is there to account for the possibility of the VLINE going to the end of the axis, with your label on the end of that line. However, since you know that will not happen in your case, use the OFFSETMAX option on the COLAXIS statement to manually adjust the axis offset to remove the space.

 

Hope this helps!

Dan

View solution in original post

1 REPLY 1
DanH_sas
SAS Super FREQ

The space is there to account for the possibility of the VLINE going to the end of the axis, with your label on the end of that line. However, since you know that will not happen in your case, use the OFFSETMAX option on the COLAXIS statement to manually adjust the axis offset to remove the space.

 

Hope this helps!

Dan

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 1014 views
  • 1 like
  • 2 in conversation