BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello,

I would like to get a scatter plot with a mean for the middle line and 90% for the outline.  Is there a way to approach it?  Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

That's much clearer, but really, that should have been your original explanation. We shouldn't have to repeatedly ask for details and repeatedly ask for clarification. We request that from now on you provide much clearer and more complete problem descriptions in your original problem description.

 

One thing I am assuming is that for IQR, you want the plot to show the 25%-ile and 75%-ile, and not the actual IQR, which is the subtraction of the two. But you didn't really say that.

 

proc summary data=sashelp.class;
    var height weight;
    output out=_stats_ mean(height)=x_mean p25(weight)=y_p25 p75(weight)=y_p75 p90(weight)=y_p90;
run;
data _null_;
	set _stats_;
	call symputx('x_mean',x_mean);
	call symputx('y_p25',y_p25);
	call symputx('y_p75',y_p75);
run;
proc sgplot data=sashelp.class;
    scatter x=height y=weight;
    refline &x_mean/axis=x;
    refline &y_p25 &y_p75/axis=y;
run;

 

 

To find X above the 90th percentile of Y

 

data want;
    if _n_=1 then set _stats_ (keep=y_p90);
    set sashelp.class;
    where x>y_p90;
run;

 

--
Paige Miller

View solution in original post

9 REPLIES 9
PaigeMiller
Diamond | Level 26

Mean of what? 90% of what? Can you show us an example of this plot?

--
Paige Miller
ybz12003
Rhodochrosite | Level 12
mean for x, IQR 90
PaigeMiller
Diamond | Level 26

What is "IQR 90"? Does it refer to the variable on the X-axis or the variable on the Y-axis, or something else?


Repeating:

 

Can you show us an example of this plot?

--
Paige Miller
ybz12003
Rhodochrosite | Level 12
Y IQR 90
Reeza
Super User

IQR is usually interquartile range, 90 is usually 90th percentile. 

Which of the two are you asking for?

 

Yes, this can be done, use REFLINE/BAND statements and pre-calculate your statistics and add them to the data set. 

 

 

PaigeMiller
Diamond | Level 26

So you want a scatter plot with mean of X and IQR 90 of Y? You still have not explained what IQR 90 is.

--
Paige Miller
ybz12003
Rhodochrosite | Level 12
First, I would like to get the scatter plot with X mean with Y IQR. Second, I would like to obtain the X list over 90% Y. The latter doesn't need to be plotted.
PaigeMiller
Diamond | Level 26

That's much clearer, but really, that should have been your original explanation. We shouldn't have to repeatedly ask for details and repeatedly ask for clarification. We request that from now on you provide much clearer and more complete problem descriptions in your original problem description.

 

One thing I am assuming is that for IQR, you want the plot to show the 25%-ile and 75%-ile, and not the actual IQR, which is the subtraction of the two. But you didn't really say that.

 

proc summary data=sashelp.class;
    var height weight;
    output out=_stats_ mean(height)=x_mean p25(weight)=y_p25 p75(weight)=y_p75 p90(weight)=y_p90;
run;
data _null_;
	set _stats_;
	call symputx('x_mean',x_mean);
	call symputx('y_p25',y_p25);
	call symputx('y_p75',y_p75);
run;
proc sgplot data=sashelp.class;
    scatter x=height y=weight;
    refline &x_mean/axis=x;
    refline &y_p25 &y_p75/axis=y;
run;

 

 

To find X above the 90th percentile of Y

 

data want;
    if _n_=1 then set _stats_ (keep=y_p90);
    set sashelp.class;
    where x>y_p90;
run;

 

--
Paige Miller
ybz12003
Rhodochrosite | Level 12
Thanks. Sometimes, I'm unsure what I want until the experts guild me.

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
  • 9 replies
  • 495 views
  • 0 likes
  • 3 in conversation