- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Mean of what? 90% of what? Can you show us an example of this plot?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content