Hi,
I've been searching hi & low for code similar to this:http://robslink.com/SAS/democd33/rugby_info.htm
mainly interesting in the pki values with a bar chart using a different format via gchart. I've just begun understanding how to create simple charts and want to understand concepts working with more complex charts. Currently I do this using excel and make an invisible line with a visible tick or line marker. using the code from Robs website seems fine however I'd like to use dataskin=sheen or the other 5 options with dataskin. For the bars I'd like to make them have 2yaxis for the % (mean & goal bars).
I've searched everywhere and this is the ONLY example I've found that fits perfectly, however not sure how to transform this into gplot or sgplot for that matter. If anyone has similar charts I'd be very interesting in looking at the code. Cheers
Marv
One possible option is the High-Low plot.
proc sgplot data=mydata; vbarparm category=original_order response=points/ barwidth=0.6 dataskin=sheen fillattrs=(color=cx4f81bd); highlow x=original_order high=mean_high low=mean_low/type=bar clusterwidth=1 fillattrs=(color=red) nooutline; highlow x=original_order high=goal_high low=goal_low/type=bar clusterwidth=1 fillattrs=(color=yellow) nooutline; run;
You have to add mean_high and mean_low / goal_high and goal_low to the dataset, something like this:
data mydata; input PlayerPosition $ 1-22 PlayerName $ 24-41 Points Mean Goal; original_order+1; mean_high=mean+15; mean_low=mean-15; goal_high=goal+15; goal_low=goal-15; datalines; 1 - Loosehead\Prop Amit Agrawal 1187.06 870.58 957.638 2 - Hooker Chalam\Madapalia 1105.64 660.62 726.682 3 - Tighthead\Prop Rob Joyner 539.33 715.33 786.863 3 - Tighthead\Prop Robert Allison 627.14 715.33 786.863 4 - Left Lock Kyle Pippinger 61.04 896.17 985.787 4 - Left Lock Horace\Stainback 1204.15 896.17 985.787 5 - Right Lock Navaid Baqai 1688.76 916.90 1008.590 6 - Blindside\Flanker Frank Scalia 1342.54 890.15 979.165 7 - Openside\Flanker Sheila Douglas 1362.77 827.35 910.085 8 - Number 8 Lolsy\Sepulveda 1119.28 1020.48 1122.528 ; run;
I don't do the other fancy stuff in Rob's as that would take some time, but it's not terribly difficult in SGPLOT.
Similar to the 'dataskins', you can use ods styles in sas/graph (gchart, gplot, etc). Ods styles are not quite as fancy as skins though.
Here is the image from the above example - maybe if the ods graphics folks see it, they'll know of an easy way to do this with sgplot and such...
One possible option is the High-Low plot.
proc sgplot data=mydata; vbarparm category=original_order response=points/ barwidth=0.6 dataskin=sheen fillattrs=(color=cx4f81bd); highlow x=original_order high=mean_high low=mean_low/type=bar clusterwidth=1 fillattrs=(color=red) nooutline; highlow x=original_order high=goal_high low=goal_low/type=bar clusterwidth=1 fillattrs=(color=yellow) nooutline; run;
You have to add mean_high and mean_low / goal_high and goal_low to the dataset, something like this:
data mydata; input PlayerPosition $ 1-22 PlayerName $ 24-41 Points Mean Goal; original_order+1; mean_high=mean+15; mean_low=mean-15; goal_high=goal+15; goal_low=goal-15; datalines; 1 - Loosehead\Prop Amit Agrawal 1187.06 870.58 957.638 2 - Hooker Chalam\Madapalia 1105.64 660.62 726.682 3 - Tighthead\Prop Rob Joyner 539.33 715.33 786.863 3 - Tighthead\Prop Robert Allison 627.14 715.33 786.863 4 - Left Lock Kyle Pippinger 61.04 896.17 985.787 4 - Left Lock Horace\Stainback 1204.15 896.17 985.787 5 - Right Lock Navaid Baqai 1688.76 916.90 1008.590 6 - Blindside\Flanker Frank Scalia 1342.54 890.15 979.165 7 - Openside\Flanker Sheila Douglas 1362.77 827.35 910.085 8 - Number 8 Lolsy\Sepulveda 1119.28 1020.48 1122.528 ; run;
I don't do the other fancy stuff in Rob's as that would take some time, but it's not terribly difficult in SGPLOT.
Snoopy,
Thank you so much! This is exactly what I was looking for. The type=bar is the key!
Rob,
Thanks for your input and by the way excellent site you have, I can't seem to find a site on SAS anywhere like yours and it's the BEST!
Marv
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.
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.
Ready to level-up your skills? Choose your own adventure.