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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1028 views
  • 0 likes
  • 2 in conversation