- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Can you please help with option in proc sgplot that displays 5 percentiles:
10th, 25th, 50th, 75th and 90th.
Here it is the code and the output:
proc sgplot data=output_1;
by SubType;
hbox AGE / category=AVAL;
run;
Thank you!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @DmytroYermak,
With your SAS 9.4M5 (and SAS 9.4M2 and later releases) you can also use the WHISKERPCT= option:
hbox AGE / category=AVAL whiskerpct=10;
Then the whiskers will indicate the 10th and 90th percentile. The 25th and 75th percentile are (by default) the edges of the box and the 50th percentile the line inside the box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What version of SAS do you have? Very specifically, such as SAS 9.4TS1M6.
The graphical options change quickly. The code below will show the image.
proc product_status;
run;
I suspect what you'll need to do is pre-calculate the percentiles (PROC SUMMARY) and then use a SCATTER or TEXT statement to plot those points correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank yo for the replying. I have the following version:
For SAS/GRAPH ...
Custom version information: 9.4_M5
For SAS/IML ...
Custom version information: 14.3
For High Performance Suite ...
Custom version information: 2.2_M6
For SAS/ACCESS Interface to PC Files ...
Custom version information: 9.4_M5
Could you please provide a link or draft syntax of such sort of calculations?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @DmytroYermak,
With your SAS 9.4M5 (and SAS 9.4M2 and later releases) you can also use the WHISKERPCT= option:
hbox AGE / category=AVAL whiskerpct=10;
Then the whiskers will indicate the 10th and 90th percentile. The 25th and 75th percentile are (by default) the edges of the box and the 50th percentile the line inside the box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Nice! I hadn't noticed WHISKERPCT. Always dangerous to say SAS can't do something. : )
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Quentin wrote:
Nice! I hadn't noticed WHISKERPCT. Always dangerous to say SAS can't do something. : )
It's good to be wrong sometimes, glad I was as well! 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So you want whiskers that extend to the 10th and 90th percentiles?
I don't think SGPLOT can do that. I think you might need to calculate the percentiles yourself, then use GTL BOXPARM to draw the box plots.
Or actually, just came across this blog post where Sanjay Matange shows a way to make a custom box plot by using SGPLOT to make a HIGHLOW plot. Looks promising.
https://blogs.sas.com/content/graphicallyspeaking/2013/03/24/custom-box-plots/
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can use the DISPLAYSTATS option to show them, but you will need to use a VBOX statement instead of the HBOX statement to use that option. Try DISPLASTATS=ALL to see all of the available stats, but you can use a parenthesized list of stats to display the ones you want.
Hope this helps!
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you all! WHISKERPCT= option has worked out.