BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Abdus-Salaam
Obsidian | Level 7

Dear SAS community,

 i want to unbold the title of a SGPANEL graphic but i haven't found a working solution for it. here is my code:

data Gesamt_Pflanzen_TM_NStufe_MT1;
...

/* Presettings */
ods html5 style=analysis path="D:\Masterthesis\Statistik\2024\Grafiken"
          file="Gesamt-Pflanzen-TM_25-4-24_NStufe.html";
ods graphics / reset;
ods graphics / width=3.5in height=3.0in;
ods escapechar='^';
* ods text="^S={font_face='Arial' font_weight=normal font_size=11pt color=black}Mischungsverhältnis Erbse : Gerste (%)"; /* hasn't worked */

title height=11pt "Mischungsverhältnis Erbse : Gerste (%)";





/* Data preparation */
data Gesamt_Pflanzen_TM_NStufe_MT1;
    set Gesamt_Pflanzen_TM_NStufe_MT1;
    Low = Mittelwert - Standardfehler; /* Untere Grenze Fehlerbalken*/
    High = Mittelwert + Standardfehler; /* Obere Grenze Fehlerbalken */
LabelPos = High + 10.0; /* Position der Buchstaben */
run;

proc format;
    value NStufeFmt
        0 = "0 kg N ha(*ESC*){unicode '207B'x}^{unicode '00B9'x}"
        1 = "96 kg N ha(*ESC*){unicode '207B'x}^{unicode '00B9'x}";
run;

 proc format;
value BehandlungFmt
1 = "0:100"
2 = "100:0"
3 = "90:10"
4 = "70:30"
5 = "80:40"
6 = "80:30"
7 = "50:50"
8 = "Brache";
run;

/* Creating bar chart*/
proc sgpanel data=Gesamt_Pflanzen_TM_NStufe_MT1 noautolegend/* Legende wird nicht automatisch erstellt */;
format Behandlung Behandlungfmt.;
    panelby Behandlung / noheaderborder headerattrs=(size=11pt weight=normal)
columns=5 rows=1 novarname;
format Duengerstufe NStufefmt.; 
    vbarparm category=Duengerstufe response=Mittelwert / 
group=Duengerstufe 
groupdisplay=cluster;
    highlow x=Duengerstufe low=Low high=High / group=Duengerstufe 
lineattrs=(color=black thickness=1 pattern=solid) /* Schwarze, durchgezogene Linie */
highcap=serif lowcap=serif; /* vertikale Striche an den Enden */
scatter x=Duengerstufe y=LabelPos / 
        datalabel=Buchstabe /* Buchstaben für Fehlerbalken */
        datalabelattrs=(size=10pt weight=bold color=black)
datalabelpos=center /* Zentrierung der Buchstaben auf Fehlerbalken */
        markerattrs=(size=0); /* Unsichtbarer Marker */
    rowaxis label="Pflanzen-TM (kg ha^{unicode '207B'x}^{unicode '00B9'x})" labelattrs=(size=11pt);
    colaxis label="Düngerstufe" labelattrs=(size=11pt weight=normal) valueattrs=(size=10pt)/* Schriftgröße der Achsenwerte */; 
run;

ods html5 close;​


Can someone of you help me with this problem?
1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Amethyst | Level 16
title font='Arial' " " height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

EDIT:

This is the result with my fake-data:

yabwon_0-1735562066632.png

 

Fake data:

data Gesamt_Pflanzen_TM_NStufe_MT1;
  do Behandlung = 1 to 8;
    Duengerstufe = mod(Behandlung,2);
    do Mittelwert = 100 to 1000 by 100;
      Standardfehler=0.1*Mittelwert;
      Buchstabe=Mittelwert;
      output;
    end;
  end;
run;

Remember always provide test data! It wasn't that hard to generate some... right?

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

5 REPLIES 5
yabwon
Amethyst | Level 16
title font='Arial' " " height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

EDIT:

This is the result with my fake-data:

yabwon_0-1735562066632.png

 

Fake data:

data Gesamt_Pflanzen_TM_NStufe_MT1;
  do Behandlung = 1 to 8;
    Duengerstufe = mod(Behandlung,2);
    do Mittelwert = 100 to 1000 by 100;
      Standardfehler=0.1*Mittelwert;
      Buchstabe=Mittelwert;
      output;
    end;
  end;
run;

Remember always provide test data! It wasn't that hard to generate some... right?

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Abdus-Salaam
Obsidian | Level 7

It works. Thank you really much! 

I'm sorry, i haven't thought of sample data.

DanH_sas
SAS Super FREQ

That was a really creative solution, @yabwon! For the record, the title boldness is coming from the "Analysis" style definition. If you use this style a lot, you might want to derive a new Analysis (let's call it "my_analysis") that removes the bold titles. You will only need to run this code once, as it will store the style in your SASUSER by default.

 

proc template;
define style my_analysis;
parent=styles.analysis;

class GraphFonts /
        "GraphAnnoFont" = ("<sans-serif>, <MTsans-serif>", 10pt)
         'GraphTitle1Font' = ("<sans-serif>, <MTsans-serif>",14pt)
         'GraphTitleFont' = ("<sans-serif>, <MTsans-serif>",11pt)
         'GraphFootnoteFont' = ("<sans-serif>, <MTsans-serif>",10pt,italic)
         'GraphLabelFont' = ("<sans-serif>, <MTsans-serif>",10pt,bold)
         'GraphLabel2Font' = ("<sans-serif>, <MTsans-serif>",10pt)
         'GraphValueFont' = ("<sans-serif>, <MTsans-serif>",9pt)
         "GraphUnicodeFont" = ("<MTsans-serif-unicode>", 9pt)
         'GraphDataFont' = ("<sans-serif>, <MTsans-serif>",7pt);

end;
run;
PaigeMiller
Diamond | Level 26

@yabwon 

Can you explain why this works?

--
Paige Miller
yabwon
Amethyst | Level 16

Hi Paige.

 

To be 100% honest, I'm not sure how it worked. 

The first track that it (font=) could help was this part of the documentation:

strange title behaviour.PNG

 

So I've started with simple:

title font='Arial' height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

which didn't work:

yabwon_0-1736416993233.png

 

Then using good old "by try&error" approach I added:

title font='Arial' "ABC" height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

Which gave:

yabwon_1-1736417109010.png

 

And then by replacing ABC with space the final version popped up.

 

But... I did some more experiments after you asked about explanation and here what I'v got:

When I add "/bold" to the font name it "does not work" again:

title font='Arial/bold' " " height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

Result:

yabwon_2-1736418330691.png

 

What's even more interesting adding, adding "/italic" (only) makes it BOTH italic and bold:

title font='Arial/italic' " " height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

yabwon_3-1736418430642.png

 

But when you make it like this:

title font='Arial/italic' " " height=11pt font='Arial' "Mischungsverhältnis Erbse : Gerste (%)";

works again (!)...

 

 

Another "interesting" behaviour, when I play with multiple different fonts, e.g.,

title font='Arial' " " font='Times New Roman' "Mischungsverhältnis Erbse : Gerste (%)";

the "Gesamt-Pflanzen-TM_25-4-24_NStufe.html" file has Arial in it, but the "default" SAS html document generated in WORK's sashtml1.htm file is Times...

yabwon_5-1736418883413.png

(even if there is no Arial at all...

title font='Times New Roman' " " height=11pt "Mischungsverhältnis Erbse : Gerste (%)";

it displays Arial)

 

All the best

Bart

 

 

 

 

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



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
  • 5 replies
  • 2160 views
  • 11 likes
  • 4 in conversation