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

I used the following template to fit 2 histograms on the same image.

proc template;

define statgraph Auszahlungshist;

begingraph;

entrytitle "Auszahlungsquoten"; /** optional title **/

layout overlay / xaxisopts=(label="Auszahlungsquote");

/** first plot: a histogram **/

histogram NGS_Auszahlungsquote_&Jahr11. / name="AuszahlungsQ19"

binwidth=0.02;

/** second plot: a semi-transparent histogram **/

histogram NGS_Auszahlungsquote_&Jahr12. / name="AuszahlungsQ18"

binwidth=0.02 datatransparency=0.7

fillattrs=(color=red);

/** optional: add legend by specifying names **/

discretelegend "AuszahlungsQ19" "AuszahlungsQ18";

endlayout;

endgraph;

end;

run;

proc sgrender data=Daten4Dashboard3 template=Auszahlungshist;

run;


In addition, I tried to add a normal fitting curve to the 2 histograms in the template. I cannot achieve this.
Do you have a way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
PierreYvesILY
Pyrite | Level 9

hi, problem solved with:

 

proc template;

define statgraph Auszahlungshist;

begingraph;

entrytitle "Auszahlungsquoten"; /** optional title **/

layout overlay / xaxisopts=(label="Auszahlungsquote");

/** first plot: a histogram **/

histogram NGS_Auszahlungsquote_&Jahr11. / name="AuszahlungsQ19"

binwidth=0.02;

densityplot NGS_Auszahlungsquote_&Jahr11. / normal() name="AuszahlungsQ19";

/** second plot: a semi-transparent histogram **/

histogram NGS_Auszahlungsquote_&Jahr12. / name="AuszahlungsQ18"

binwidth=0.02 datatransparency=0.7

fillattrs=(color=red);

densityplot NGS_Auszahlungsquote_&Jahr12. / normal() name="AuszahlungsQ18"

datatransparency=0.7 lineattrs=(color=red);

/** optional: add legend by specifying names **/

discretelegend "AuszahlungsQ19" "AuszahlungsQ18";

endlayout;

endgraph;

end;

run;

View solution in original post

1 REPLY 1
PierreYvesILY
Pyrite | Level 9

hi, problem solved with:

 

proc template;

define statgraph Auszahlungshist;

begingraph;

entrytitle "Auszahlungsquoten"; /** optional title **/

layout overlay / xaxisopts=(label="Auszahlungsquote");

/** first plot: a histogram **/

histogram NGS_Auszahlungsquote_&Jahr11. / name="AuszahlungsQ19"

binwidth=0.02;

densityplot NGS_Auszahlungsquote_&Jahr11. / normal() name="AuszahlungsQ19";

/** second plot: a semi-transparent histogram **/

histogram NGS_Auszahlungsquote_&Jahr12. / name="AuszahlungsQ18"

binwidth=0.02 datatransparency=0.7

fillattrs=(color=red);

densityplot NGS_Auszahlungsquote_&Jahr12. / normal() name="AuszahlungsQ18"

datatransparency=0.7 lineattrs=(color=red);

/** optional: add legend by specifying names **/

discretelegend "AuszahlungsQ19" "AuszahlungsQ18";

endlayout;

endgraph;

end;

run;

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1006 views
  • 0 likes
  • 1 in conversation