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

Hello,  I have 2 variables:  binomialpdf and X.   I use the following procedure

proc sgplot data =one;
scatter y=binomialpdf x=x;
run;

 

Golf_0-1591842872102.png

Is there anyway to put area under each dot in the above graph?

Thank You.

 

 

   

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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;

View solution in original post

7 REPLIES 7
JeffMeyers
Barite | Level 11

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.

Golf
Pyrite | Level 9
Thank You.
Golf
Pyrite | Level 9

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.

Golf_0-1591846560926.png

 

 

 


run;

 

Ksharp
Super User

You want this ?

 

proc sgplot data=sashelp.air ;
scatter x=date y=air;
band x=date lower=0 upper=air / transparency=0.5;
run;
Golf
Pyrite | Level 9
Thank You.
Rick_SAS
SAS Super FREQ

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;
Golf
Pyrite | Level 9
Dear Rick,
Thank You for your help. This is what I want.
Bests,
Golf

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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
  • 7 replies
  • 1822 views
  • 4 likes
  • 4 in conversation