Hello, this problem is troubling my mind: I'm creating graphs via sgplot, a histogram with two groups (0&1) displayed in one graph. It works fine, as long as I don't use labels I made via proc template for my group variable. Then one group just disappears. Depending on how I sort my group variable, only the 'yes' or 'no' group is displayed. It's still the same data and the same group variable I put into the graph, it just got a label now. The labels work perfectly fine on different other procs like proc mean. In the log there is no error message. There are several scenarios I performed, the problem seems to lie with the histogram, group and label statement. I created dummy data and I experience the same problem there. If the group varibale is a string (yes/no) both groups are displayed. If I use a different graph kind in sgplot, both groups are displayed even if labeld. My Sas Version is 9.4 (TS1M2) Below I insert my code, the graphs and in the attachment you can find the dummy data. Anybody got ideas how to solve this? (Other then transforming the group variable into a string) *Graph without labeled group variable; proc sort data=test; by anaemia; run;
proc sgplot data=test;
histogram Hb / GROUP=anaemia transparency=0.5;
density Hb / GROUP=anaemia; run; *Creating format;
proc format; value yn 0='No' 1='Yes'; run;
data test2; set test; format anaemia yn.; run;
*Labels work;
proc freq data=test2; table anaemia; run;
*Creating same graph again, only one group is displayed;
proc sort data=test2; by anaemia; run;
proc sgplot data=test2;
histogram Hb / GROUP=anaemia transparency=0.5;
density Hb / GROUP=anaemia;
run;
... View more