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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 7 replies
  • 974 views
  • 4 likes
  • 4 in conversation