i have table as below, How to change the order to display in month order
Table:
input Affected_CI count;
datalines;
'54JFY5 Prtfolios ledger - January' 10
'54JFY5 Prtfolios ledger - February' 17
'66ABC5 Fund Data Correction - -March' 7;
run;
result as below:
expecting in order January,February and march x-as order.
You can use the search bar on the main page to search for topics similar to your question.
The simplest method is to change the xaxis values to be numbers, and to that field apply a format, so the data sorts per number and displays the formatted version:
proc format; value t 1='54JFY5 Prtfolios ledger - January' 2='54JFY5 Prtfolios ledger - February' 3='66ABC5 Fund Data Correction - -March'; run; data inter; set have; if affected_ci='54JFY5 Prtfolios ledger - January' then xasxisvar=1; if ...; format xaxisvar t.; run;
Then use xaxisvar on your xaxis.
The app names are not constant.they are generated on different queries.
Then dynamically create the proc format step.
data _null_; set your_query_results end=last; if _n_=1 then call execute('proc format; value t ');
call execute(strip(put(_n_,best.),'=',strip(quote(query_result_text)," ");
if last then call execute(';run;');
run;
I can only answer what is provided.
An alternate approach would be have an actual DATE value for the xaxis (fixes the sort issue) using an appropriate format for the display and then have a separate variable, possibly fund, that contains the other text like "54JFY5 Prtfolios ledger" and use that as a group variable and groupdisplay=cluster.
Yes this would move some of the information from the Axis to a Legend. Depending on the values involved that may be easier to manage long values.
I have to say that having the same color appear for two apparently unrelated data bits
54JFY5 Prtfolios ledger and 66ABC5 Fund Data Correction is really confusing.
resolved by adding
xaxis display=(nolabel) discreteorder=data;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.