BookmarkSubscribeRSS Feed
Herwibawa
Calcite | Level 5

My experiment arranged in Split Plot design. How to make a Charts/ Boxplots for Proportions of a Binary Variable ?

data Survival;

  input A $ B $ Block Y;  if Y=1 then 1='Survive'; else 0='Died';

datalines;

A1     B1     1      0

A1     B1     2      1

A1     B1     3      0

A1     B1     4      0

A1     B1     5      0

A1     B2     1      1

A1     B2     2      1

A1     B2     3      1

A1     B2     4      1

A1     B2     5      0

A1     B3     1      1

A1     B3     2      0

A1     B3     3      0

A1     B3     4      1

A1     B3     5      1

A2     B1     1      0

A2     B1     2      0

A2     B1     3      0

A2     B1     4      0

A2     B1     5      0

A2     B2     1      1

A2     B2     2      0

A2     B2     3      0

A2     B2     4      1

A2     B2     5      0

A2     B3     1      1

A2     B3     2      1

A2     B3     3      1

A2     B3     4      0

A2     B3     5      1

A3     B1     1      1

A3     B1     2      0

A3     B1     3      1

A3     B1     4      0

A3     B1     5      0

A3     B2     1      0

A3     B2     2      1

A3     B2     3      1

A3     B2     4      1

A3     B2     5      0

A3     B3     1      0

A3     B3     2      1

A3     B3     3      0

A3     B3     4      1

A3     B3     5      1

;

 

Is it true when it displayed in as shown below ? how to write the codes?

 

original.jpg

 

 

Please help me it is so important for me...

1 REPLY 1
Rick_SAS
SAS Super FREQ

I assume you know how to model the data to obtain the probabilities, and that you are asking about how to create the box plot of the results.

 

You don't mention what version of SAS you are running, but here's how to create the plot in the current version:

 

data Sim;
label p = "Survival Probability (%)";
call streaminit(1);
do i = 1 to 20;
   Genotype = 1;  Status = "Perishing";
   p = rand("normal", 32, 10) / 100;
   output;
   Genotype = 1;  Status = "Surviving";
   p = rand("normal", 72, 5) / 100;
   output;
   Genotype = 2;  Status = "Perishing";
   p = rand("normal", 32, 10) / 100;
   output;
   Genotype = 2;  Status = "Surviving";
   p = rand("normal", 74, 8) / 100;
   output;
end;
run;

proc sgplot data=Sim;
format p PERCENT8.; vbox p / category=Genotype group=Status nofill nooutliers groupdispay=overlay; scatter y=p x=Genotype / group=Status; run;

 

One question you might have is when to use CATEGORY= and when to use GROUP=. For an explanation, see the article "What is the difference between categories and groups in PROC SGPLOT?"


Region Capture.png

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1922 views
  • 0 likes
  • 2 in conversation