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

Hello All,

 

 

I have the following data

 SUBCATEGORY    Pieces     defects         Failure%
product 1                      248        41                 17
product 2                      252        80                32
product 3                      127        23                18
product 4                       397          6                 2
product 5                       107          8                  7
product 6                        52            10             19
product 7                        79              0               0
product 8                          174          4                2
product 9                           670         134            20
product 10                        227             23            10
product 11                         383              8              2
product 12                       110                 20           18
product 13                       461                 7             2
product 14                      182                66            36
product 15                       83                 17            20
product 16                       130                 1              1
product 17                         176                0               0

 

Can i create a graph that is attached in enterprise guide

 

 

Thanks,

jay

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

This code should do it for you:

 

data products;
label Failure="Failure%";
input SUBCATEGORY $ 1-10 Pieces  defects Failure;
cards;
product 1   248   41  17
product 2   252   80  32
product 3   127   23  18
product 4   397    6   2
product 5   107    8   7
product 6    52   10  19
product 7    79    0   0
product 8   174    4   2
product 9   670  134  20
product 10  227   23  10
product 11  383    8   2
product 12  110   20  18
product 13  461    7   2
product 14  182   66  36
product 15   83   17  20
product 16  130    1   1
product 17  176    0   0
;
run;

proc sgplot data=products;
xaxis display=(nolabel);
yaxis display=(nolabel);
vbarparm category=subcategory response=pieces / datalabel discreteoffset=-0.3 barwidth=0.25;
vbarparm category=subcategory response=defects / datalabel barwidth=0.25;
vbarparm category=subcategory response=failure / datalabel discreteoffset=0.3 barwidth=0.25;
run;

View solution in original post

4 REPLIES 4
DanH_sas
SAS Super FREQ

This code should do it for you:

 

data products;
label Failure="Failure%";
input SUBCATEGORY $ 1-10 Pieces  defects Failure;
cards;
product 1   248   41  17
product 2   252   80  32
product 3   127   23  18
product 4   397    6   2
product 5   107    8   7
product 6    52   10  19
product 7    79    0   0
product 8   174    4   2
product 9   670  134  20
product 10  227   23  10
product 11  383    8   2
product 12  110   20  18
product 13  461    7   2
product 14  182   66  36
product 15   83   17  20
product 16  130    1   1
product 17  176    0   0
;
run;

proc sgplot data=products;
xaxis display=(nolabel);
yaxis display=(nolabel);
vbarparm category=subcategory response=pieces / datalabel discreteoffset=-0.3 barwidth=0.25;
vbarparm category=subcategory response=defects / datalabel barwidth=0.25;
vbarparm category=subcategory response=failure / datalabel discreteoffset=0.3 barwidth=0.25;
run;
jb9977
Fluorite | Level 6

Hi Dan,

Thanks for the quick reply. One question how can I change the failure% in the above data to a line in the same chart. To make it a Dual axis bar line chart.

 

 

Thanks,

Jay

DanH_sas
SAS Super FREQ

See if this will get you what you want:

 

proc sgplot data=products cycleattrs;
xaxis display=(nolabel);
yaxis display=(nolabel);
vbarparm category=subcategory response=pieces / datalabel discreteoffset=-0.2 barwidth=0.4;
vbarparm category=subcategory response=defects / datalabel discreteoffset=0.2 barwidth=0.4;
series x=subcategory y=failure / datalabel y2axis lineattrs=(thickness=2);
run;
jb9977
Fluorite | Level 6
Thank you very much Dan for your help. This is what I have been trying for. Can you suggest me any book or material where I can learn more about charts and plots in EG?

Thanks,
Jay

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
  • 4 replies
  • 1726 views
  • 0 likes
  • 2 in conversation