04-25-2018 10:20 AM
i have table as below, How to change the order to display in month order
input Affected_CI count;
'54JFY5 Prtfolios ledger - January' 10
'54JFY5 Prtfolios ledger - February' 17
'66ABC5 Fund Data Correction - -March' 7;
result as below:
expecting in order January,February and march x-as order.
04-25-2018 10:27 AM
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.
04-25-2018 11:12 AM
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;');
I can only answer what is provided.
04-25-2018 11:25 AM
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.
Need further help from the community? Please ask a new question.