Hi,
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
g100 group=status_bucket
nozero raxis=axis1 maxis=axis2 gaxis=axis3 ;
run;
quit;
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
Thanks,
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:
proc format;
value bucket
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'
;
run;
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.
Thanks.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.