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

Hello Everyone,

 

I am trying to produce this graph below with the following data

blockCountPercent CategoryType
  
159%AnyChronicGapPer Patients
12423%AnyChronicGapPer Veins
164878%AnyChronicGapPer Segments
159%ChronicGapPer Patients
12423%ChronicGapPer Veins
164878%ChronicGapPer Segments
11121%AcuteGapPer Patients
14139%AcuteGapPer Veins
172588%AcuteGapPer Segments

Below is the code that generates my current graph 

proc sgplot data=have;
	vbar category /group=Type CLUSTERWIDTH=.8 groupdisplay=cluster response=Percent daTALABEL ;
	keylegend / location=inside position=topright;
	xaxis display=(nolabel);
	yaxis values = (0 to 1 by .2) label=" ";
	xaxistable COUNT;
run;


But i am trying to reach this final output or something close to it.

timothy19_0-1668491618997.jpeg

Thanks for your help.

Tim

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
infile cards expandtabs truncover;
input block Count Percent :percent8. Category :$20. Type $20.;
type1+1;
format percent percent5.0;
cards;
1 5 9% AnyChronicGap Per Patients
1 24 23% AnyChronicGap Per Veins
1 648 78% AnyChronicGap Per Segments
1 5 9% ChronicGap Per Patients
1 24 23% ChronicGap Per Veins
1 648 78% ChronicGap Per Segments
1 11 21% AcuteGap Per Patients
1 41 39% AcuteGap Per Veins
1 725 88% AcuteGap Per Segments
;


%sganno
data sganno;
%SGRECTANGLE(X1=23,Y1=92.5,HEIGHT=18,WIDTH=20,DISPLAY="ALL",DRAWSPACE="LAYOUTPERCENT",FILLCOLOR="white",LINECOLOR="black",LINETHICKNESS=1)

%SGTEXT(LABEL="PVI Durability",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",TEXTSIZE=10,X1=22,Y1=99,FILLCOLOR="white",FILLTRANSPARENCY=1)

%SGRECTANGLE(X1=15,Y1=95,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXFEE0D2" ,LINECOLOR="white",RESET="ALL")
%SGRECTANGLE(X1=16.5,Y1=95,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXDEEBF7" ,LINECOLOR="white")
%SGRECTANGLE(X1=18,Y1=95,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXE5F5E0" ,LINECOLOR="white")
%SGTEXT(LABEL="per PV",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",ANCHOR="LEFT",TEXTSIZE=10,X1=19,Y1=95,TEXTSTYLE="ITALIC",FILLCOLOR="white")

%SGRECTANGLE(X1=14.5,Y1=91,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXFC9272" ,LINECOLOR="white")
%SGRECTANGLE(X1=16,Y1=91,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CX9ECAE1" ,LINECOLOR="white")
%SGRECTANGLE(X1=17.5,Y1=91,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXA1D99B" ,LINECOLOR="white")
%SGTEXT(LABEL="median PV",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",ANCHOR="LEFT",TEXTSIZE=10,X1=19,Y1=91,TEXTSTYLE="ITALIC",FILLCOLOR="white")

%SGRECTANGLE(X1=14.5,Y1=87,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXDE2D26" ,LINECOLOR="white")
%SGRECTANGLE(X1=16,Y1=87,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CX3182BD" ,LINECOLOR="white")
%SGRECTANGLE(X1=17.5,Y1=87,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CX31A354" ,LINECOLOR="white")
%SGTEXT(LABEL="per Patient",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",ANCHOR="LEFT",TEXTSIZE=10,X1=19,Y1=87,TEXTSTYLE="ITALIC",FILLCOLOR="white")


 %SGPOLYGON( X1=15, Y1=5,DRAWSPACE="GRAPHPERCENT" ,LINECOLOR="black",DISPLAY="ALL",LINETHICKNESS=1)
 %SGPOLYCONT(X1=35,Y1=5)
 %SGPOLYCONT(X1=40,Y1=10)
 %SGPOLYCONT(X1=35,Y1=15)
 %SGPOLYCONT(X1=15,Y1=15)
 %SGPOLYCONT(X1=20,Y1=10)

 %SGPOLYGON( X1=45, Y1=5,DRAWSPACE="GRAPHPERCENT" ,LINECOLOR="black",DISPLAY="ALL",LINETHICKNESS=1)
 %SGPOLYCONT(X1=65,Y1=5)
 %SGPOLYCONT(X1=70,Y1=10)
 %SGPOLYCONT(X1=65,Y1=15)
 %SGPOLYCONT(X1=45,Y1=15)
 %SGPOLYCONT(X1=50,Y1=10)

 %SGPOLYGON( X1=75, Y1=5,DRAWSPACE="GRAPHPERCENT" ,LINECOLOR="black",DISPLAY="ALL",LINETHICKNESS=1)
 %SGPOLYCONT(X1=95,Y1=5)
 %SGPOLYCONT(X1=100,Y1=10)
 %SGPOLYCONT(X1=95,Y1=15)
 %SGPOLYCONT(X1=75,Y1=15)
 %SGPOLYCONT(X1=80,Y1=10)

 %SGTEXT(LABEL="Monophasic (11pts)",WIDTH=14,DRAWSPACE="GRAPHPERCENT",TEXTSIZE=10,TEXTCOLOR="CXDE2D26",X1=30,Y1=10,FILLTRANSPARENCY=1,RESET="ALL")
 %SGTEXT(LABEL="Early/Other Bisphasic (55pts)",WIDTH=14,DRAWSPACE="GRAPHPERCENT",TEXTSIZE=10,TEXTCOLOR="CX3182BD",X1=60,Y1=10,FILLTRANSPARENCY=1)
 %SGTEXT(LABEL="Optimized Biphasic (44pts)",WIDTH=14,DRAWSPACE="GRAPHPERCENT",TEXTSIZE=10,TEXTCOLOR="CX31A354",X1=90,Y1=10,FILLTRANSPARENCY=1)
run;




proc sgplot data=have noautolegend noborder pad=(bottom=80) sganno=sganno;
styleattrs datacolors=(CXFEE0D2 CXFC9272 CXDE2D26 
                      CXDEEBF7 CX9ECAE1 CX3182BD 
                      CXE5F5E0 CXA1D99B CX31A354 )
          datacontrastcolors=(CXDE2D26 CXDE2D26 CXDE2D26 
                      CX3182BD CX3182BD CX3182BD 
                      CX31A354 CX31A354 CX31A354 );
 vbarparm category=category response=Percent/group=Type1 CLUSTERWIDTH=.8 
              groupdisplay=cluster nooutline baseline=0 ;
 text x=category y=percent text=Percent/group=Type1  strip   textattrs=(size=10)
              contributeoffsets=none position=top groupdisplay=cluster;
 yaxis values = (0 to 1 by .2) max=1 valueshint label="Durability on Rem(%)" grid display=(noline noticks);
 xaxis display=none;
run;

Ksharp_0-1668513125468.png

 

View solution in original post

2 REPLIES 2
Ksharp
Super User
data have;
infile cards expandtabs truncover;
input block Count Percent :percent8. Category :$20. Type $20.;
type1+1;
format percent percent5.0;
cards;
1 5 9% AnyChronicGap Per Patients
1 24 23% AnyChronicGap Per Veins
1 648 78% AnyChronicGap Per Segments
1 5 9% ChronicGap Per Patients
1 24 23% ChronicGap Per Veins
1 648 78% ChronicGap Per Segments
1 11 21% AcuteGap Per Patients
1 41 39% AcuteGap Per Veins
1 725 88% AcuteGap Per Segments
;


%sganno
data sganno;
%SGRECTANGLE(X1=23,Y1=92.5,HEIGHT=18,WIDTH=20,DISPLAY="ALL",DRAWSPACE="LAYOUTPERCENT",FILLCOLOR="white",LINECOLOR="black",LINETHICKNESS=1)

%SGTEXT(LABEL="PVI Durability",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",TEXTSIZE=10,X1=22,Y1=99,FILLCOLOR="white",FILLTRANSPARENCY=1)

%SGRECTANGLE(X1=15,Y1=95,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXFEE0D2" ,LINECOLOR="white",RESET="ALL")
%SGRECTANGLE(X1=16.5,Y1=95,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXDEEBF7" ,LINECOLOR="white")
%SGRECTANGLE(X1=18,Y1=95,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXE5F5E0" ,LINECOLOR="white")
%SGTEXT(LABEL="per PV",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",ANCHOR="LEFT",TEXTSIZE=10,X1=19,Y1=95,TEXTSTYLE="ITALIC",FILLCOLOR="white")

%SGRECTANGLE(X1=14.5,Y1=91,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXFC9272" ,LINECOLOR="white")
%SGRECTANGLE(X1=16,Y1=91,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CX9ECAE1" ,LINECOLOR="white")
%SGRECTANGLE(X1=17.5,Y1=91,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXA1D99B" ,LINECOLOR="white")
%SGTEXT(LABEL="median PV",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",ANCHOR="LEFT",TEXTSIZE=10,X1=19,Y1=91,TEXTSTYLE="ITALIC",FILLCOLOR="white")

%SGRECTANGLE(X1=14.5,Y1=87,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CXDE2D26" ,LINECOLOR="white")
%SGRECTANGLE(X1=16,Y1=87,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CX3182BD" ,LINECOLOR="white")
%SGRECTANGLE(X1=17.5,Y1=87,HEIGHT=3,WIDTH=1,DISPLAY="FILL",DRAWSPACE="LAYOUTPERCENT" ,FILLCOLOR="CX31A354" ,LINECOLOR="white")
%SGTEXT(LABEL="per Patient",WIDTH=100,DRAWSPACE="LAYOUTPERCENT",ANCHOR="LEFT",TEXTSIZE=10,X1=19,Y1=87,TEXTSTYLE="ITALIC",FILLCOLOR="white")


 %SGPOLYGON( X1=15, Y1=5,DRAWSPACE="GRAPHPERCENT" ,LINECOLOR="black",DISPLAY="ALL",LINETHICKNESS=1)
 %SGPOLYCONT(X1=35,Y1=5)
 %SGPOLYCONT(X1=40,Y1=10)
 %SGPOLYCONT(X1=35,Y1=15)
 %SGPOLYCONT(X1=15,Y1=15)
 %SGPOLYCONT(X1=20,Y1=10)

 %SGPOLYGON( X1=45, Y1=5,DRAWSPACE="GRAPHPERCENT" ,LINECOLOR="black",DISPLAY="ALL",LINETHICKNESS=1)
 %SGPOLYCONT(X1=65,Y1=5)
 %SGPOLYCONT(X1=70,Y1=10)
 %SGPOLYCONT(X1=65,Y1=15)
 %SGPOLYCONT(X1=45,Y1=15)
 %SGPOLYCONT(X1=50,Y1=10)

 %SGPOLYGON( X1=75, Y1=5,DRAWSPACE="GRAPHPERCENT" ,LINECOLOR="black",DISPLAY="ALL",LINETHICKNESS=1)
 %SGPOLYCONT(X1=95,Y1=5)
 %SGPOLYCONT(X1=100,Y1=10)
 %SGPOLYCONT(X1=95,Y1=15)
 %SGPOLYCONT(X1=75,Y1=15)
 %SGPOLYCONT(X1=80,Y1=10)

 %SGTEXT(LABEL="Monophasic (11pts)",WIDTH=14,DRAWSPACE="GRAPHPERCENT",TEXTSIZE=10,TEXTCOLOR="CXDE2D26",X1=30,Y1=10,FILLTRANSPARENCY=1,RESET="ALL")
 %SGTEXT(LABEL="Early/Other Bisphasic (55pts)",WIDTH=14,DRAWSPACE="GRAPHPERCENT",TEXTSIZE=10,TEXTCOLOR="CX3182BD",X1=60,Y1=10,FILLTRANSPARENCY=1)
 %SGTEXT(LABEL="Optimized Biphasic (44pts)",WIDTH=14,DRAWSPACE="GRAPHPERCENT",TEXTSIZE=10,TEXTCOLOR="CX31A354",X1=90,Y1=10,FILLTRANSPARENCY=1)
run;




proc sgplot data=have noautolegend noborder pad=(bottom=80) sganno=sganno;
styleattrs datacolors=(CXFEE0D2 CXFC9272 CXDE2D26 
                      CXDEEBF7 CX9ECAE1 CX3182BD 
                      CXE5F5E0 CXA1D99B CX31A354 )
          datacontrastcolors=(CXDE2D26 CXDE2D26 CXDE2D26 
                      CX3182BD CX3182BD CX3182BD 
                      CX31A354 CX31A354 CX31A354 );
 vbarparm category=category response=Percent/group=Type1 CLUSTERWIDTH=.8 
              groupdisplay=cluster nooutline baseline=0 ;
 text x=category y=percent text=Percent/group=Type1  strip   textattrs=(size=10)
              contributeoffsets=none position=top groupdisplay=cluster;
 yaxis values = (0 to 1 by .2) max=1 valueshint label="Durability on Rem(%)" grid display=(noline noticks);
 xaxis display=none;
run;

Ksharp_0-1668513125468.png

 

timothy19
Fluorite | Level 6
Thank you

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 873 views
  • 5 likes
  • 2 in conversation