04-21-2014 12:34 PM
I am using a Proc Gchart to generate a graph with status_buckets along the xaxis and their Statuses (Pending Delivered Returned) of the each bucket on Y axis:
This is the piece of code i am using to generate the graph.
proc gchart data = Prep_File_Final_1;
vbar status_bucket/noframe descending type=pct subgroup=Status legend=legend1 inside=pct
nozero raxis=axis1 maxis=axis2 gaxis=axis3 ;
As of now the graph plots Status_bucket values like this:
$0.01 - $0.24, $0.25 - $0.49, $0.50 - $0.99, $1.00 - $4.99, $10.00 - $24.99, $100.00 - $499.99 $25.00 - $49.99, $5.00 - $9.99, $50.00 - $99.99, $500.00 - Max
i would like to get the values plotted in this order on the x axis :
$0.01 - $0.24, $0.25 - $0.49, $0.50 - $0.99, $1.00 - $4.99, $5.00 - $9.99, $10.00 - $24.99, $25.00 - $49.99, $50.00 - $99.99, $100.00 - $499.99, $500.00 - Max
04-21-2014 03:04 PM
When you want things to appear in numeric order, use numbers. I'm betting you coded status bucket as a character variable with actual values of "$0.01 - $0.24". Which was likely a step that actually isn't needed.
If you have a prior dataset with a status numeric value you likely can use that variable by applying a numeric custom format as Gchart will use formatted values for display.
The format would look like assuming the variable is decimal, 0.01 = $.01, if actually cents then remove the decimals in the format:
0.01 - 0.24 = '$0.01 - $0.24'
0.25 - 0.49 = '$0.25 - $0.49'
<contine the hopefully obvious pattern>
500 - high = '$500.00 - Max'
Or use numeric groups and format the group variable.
Then associate the format with your value variable in the proc gchart code:
format variable bucket.;
The above approach is VERY useful because you can create multiple bucket type formats and only change the format statement to see how different groups behave instead of creating multiple bucket variables.