Hello, I have 2 variables: binomialpdf and X. I use the following procedure
proc sgplot data =one;
scatter y=binomialpdf x=x;
run;
Is there anyway to put area under each dot in the above graph?
Thank You.
You can use a needle plot or a bar chart. For examples and discussion, see this blog post.
data one;
do x = 0 to 30;
binomialpdf = pdf("Binomial", x, 0.6, 30);
output;
end;
run;
proc sgplot data =one;
needle y=binomialpdf x=x / markers lineattrs=(thickness=5);
run;
proc sgplot data =one;
vbarbasic x / response=binomialPDF barwidth=1; /* requires SAS 9.4M3 */
run;
If you calculate the area outside of the SGPLOT and have it in your dataset you could use XAXISTABLE to print the numbers in the graph. I don't think SGPLOT has any Area under the curve options that it can calculate on its own.
I also try another procedure "gplot", but it looks similar even I add option "areas=1" (picture is below).
proc gplot data=chap3_binomial;
plot binomialpdf*x / areas=1;
Is there other procedure to get my objective?
Thank you.
run;
You want this ?
proc sgplot data=sashelp.air ;
scatter x=date y=air;
band x=date lower=0 upper=air / transparency=0.5;
run;
You can use a needle plot or a bar chart. For examples and discussion, see this blog post.
data one;
do x = 0 to 30;
binomialpdf = pdf("Binomial", x, 0.6, 30);
output;
end;
run;
proc sgplot data =one;
needle y=binomialpdf x=x / markers lineattrs=(thickness=5);
run;
proc sgplot data =one;
vbarbasic x / response=binomialPDF barwidth=1; /* requires SAS 9.4M3 */
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.